Section: Kernel Functions (9)
printk - print messages to console log
int printk(const char*fmt, ...)
Print a formatted message to the kernel console, much like the
function of the stdio library. Normally, the message is written to the
physical console device of the computer, although this behavior can be
changed with the
function. Messages are also stored in a message log book.
The generated string may also start with a message priority code,
which sets the priority of the message. The priority code strings are
of the form
where n is a number from 0 - 7. The following macros are defined in
System is unuseable
Action must be taken immediately
Normal but significant condition
printk(KERN_NOTICE "Hello, world.\n");
does the expected thing.
Returns the number of characters written to the log.
Stephen Williams (firstname.lastname@example.org
float and double formats are not supported. Floats and doubles do not
belong inside the kernel anyhow.
implementation protects itself from interruption, so in principle it
can be used in interrupts handlers and critical sections. However,
there are no guarantees about the console function that is registered.