site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=udJf9dM0FQxljPfJ3LprMc/B+EQamwqrQktPSErqNntMpNneZjqYU/sh1/OL3GVyVKbaEXjZ6AWf8IPtI1nH2kp+2H3GqGhi1kaqet3qXa1YMVJYId7Js9mQsTw622ip9GuhuKB3x6ntFzUlzcbMYvmmjsU7nXjcn1u0IpcGiGg= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DOXvffDgkYKIEfRaIeYkNGsPcIbF2rZLy9Q/lGUihNxxR5083OmLgurU3mBPu3KVox8mxySPyq1H4dXz+Yi5RW03DlXQadaVpXI/JOhX7zK47tCMsY1fdUegYIdwautXfvZ8FA5p8Cudz8GxzNQse/2ZEui+ux6a98VFyjMGMTU= Search the archives for "Firewire kprintf" On 23/08/07, Draichis <draichis@gmail.com> wrote:
On Aug 23, 2007, at 9:14 AM, Jernej Azarija wrote:
Hello,
I've encountered this issue too. Specifically, when a lot of calls to printf() have been made, the output looks messy. eg :
printf("foo\n"); printf("bar\n");
Ends up written in system.log as :
fobaro
(just a banal example).
Amazing.
One of the most common problems faced when programming in the kernel is use of "standard" functions—things like printf or bcopy. Many commonly used standard C library functions are implemented in the kernel. In order to use them, however, you need to include the appropriate prototypes, which may be different from the user space prototypes for those functions, and which generally have different names when included from kernel code.
In general, any non–I/O Kit header that you can safely include in the kernel is located in xnu/bsd/sys or xnu/osfmk/mach, although there are a few specialized headers in other places like libkern and libsa. Normal headers (those in /usr/include) cannot be used in the kernel (or rather, cannot be used 'properly').
If the standard C function you are trying to use is not in one of the following files, chances are the function is not supported for use within the kernel, and you need to implement your code in another way:
<sys/systm.h> (printf can be used with this) <sys/buf.h> (buffer cache functions like bread) <sys/dirent.h> (directory entries) <sys/errno.h> (Error numbers) <sys.kernel.h> (kernel special variables) <sys/lock.h> (spinlocks) <sys/malloc.h> (malloc) <sys/queue.h> (queues) <sys/rand.h> (random generation numbers) <sys/systm.h> (bzero, bcopy.. etc) <sys/system.h> (timeout, untimeout) <sys/time.h> (time functions) <sys/types.h> <mach/mach_types.h> (standard type declarations) <sys/ucred.h> (user credentials) <sys/utsname.h> (os and system information)
I checked printf() implementation and it seems that loocking *is* handled correctly so I'm really wondering what's the problem behind it.
-----Original Message----- From: darwin-kernel-bounces+jernej.azarija=hermes- softlab.com@lists.apple.com on behalf of Jeremy Pereira Sent: Thu 8/23/2007 9:35 AM To: JanakiRam Cc: darwin-kernel@lists.apple.com Subject: Re: printf logs are not getting printed properly on system.log
On 23 Aug 2007, at 06:05, JanakiRam wrote:
Hi ALL,
I'm newbie to this kernel prorgamming. Please clarify my following query.
I'm using printf for logging messages from my kext. One observation is all my logs are not getting printed when i start my kext using kextload. Its not consitent , how many logs are going to get printed every time i load the kext.
Please help me to solve this. Thanks in Advance.
I've seen the same problem. I assumed it was because of overrunning some buffer somewhere i.e. producing too much output for the kernel logging system to cope with.
-JanakiRam.
--- Draichis
draichis@gmail.com draichis@craplandia.org http://draichis.craplandia.org
"I know that fewer people are won over by the written word than by the spoken word and that every great movement on this earth owes its growth to great speakers and not to great writers."
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/bogvardi%40gmail.com
This email sent to bogvardi@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com