Printk

From eLinux.org
Revision as of 14:28, 27 October 2011 by Cschalle (talk | contribs) (Add category)
Jump to: navigation, search

printk is the routine used to submit a message to the kernel log buffer

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: http://www.embedded-bits.co.uk/2010/printk-format-specifiers/

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: