Difference between revisions of "Printk"

From eLinux.org
Jump to: navigation, search
m (Add category)
(Consolidated with Debugging_by_printing)
Line 1: Line 1:
printk is the routine used to submit a message to the kernel log buffer
#REDIRECT [[Debugging_by_printing]]
See http://www.ibm.com/developerworks/linux/library/l-kernel-logging-apis/index.html
== conversion specifiers ==
Most of the conversion specifiers supported by the user-space library routine printf()
are also available in the kernel. 
However there are some exceptions (I don't think 64-bit types are supported on 32-bit systems).
Also, there are some notable additions, including "%pf", which will print the symbol name in place of the numeric pointer value, if available.
There is a file printk-formats in the kernel Documentation directory
describing the difference conversion specifiers that are available.
See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/printk-formats.txt
(But, as of kernel 2.6.37, this file did not include information about the %p* conversions.)
For information about the %p variants available in the kernel, see:
== disabling printk messages at compile time ==
There is a configuration option which allows you to turn off all the printk messages in the
whole kernel (CONFIG_PRINTK).  This reduces the size the kernel, usually by at least 100k,
since all the message strings are not compiled into the kernel binary image.  However, it
also means you get absolutely no output from the kernel while it is running.  Disabling kernel
printk messages is usually the last thing you do when you are tuning your kernel for size.
== pages related to printk ==
Some page related to printk:
* [[Printk Times]] - has information about how to turn on timestamps for each printk message
** [[Printk_Times_Sample_4| printk time stamps sample]]
* [[Printk_Size_Info|printk size information]]
* [[Do Printk]] - has information about a method of disabling printk messages on a per-module basis

Latest revision as of 14:15, 3 April 2012