Just a quick question on printk() function at the kernel level, if I call this where will the message be printed to?(I'm using Ubuntu on i386 arch with the latest kernel download)
can't find it anywhere,
If someone could also point me in the right direction for some sort of manual for the printk() function it would be great!
printk is a C function from the Linux kernel interface that prints messages to the kernel log. It accepts a string parameter called the format string, which specifies a method for rendering an arbitrary number of varied data type parameter(s) into a string. The string is then printed to the kernel log.
The information which is printed by printk() can only be seen under Alt + Ctrl + F1 ~ F7 console.
Difference between Printk() and Printf() in Linux :printf() is a C Standard Library function. printk() is used by the kernel to print. To print something from the application layer it uses printf(). The printk() method can be called at any time from almost anywhere in the kernel.
dmesg should display printk messages.
printk messages go to the kernel log message buffer, which can be exposed in a variety of ways depending on system configuration. The shell command dmesg will show them, and they should also be being copied to files in /var/log by the syslog daemon. It's possible to get them logged to a serial console or a text-mode virtual terminal, but I don't remember how offhand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With