Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Message printing – printk()

printk() is to the kernel what printf() is to the user space. Lines written by printk() can be displayed through the dmesg command. Depending on how important the message you need to print is, you can choose between eight log-level messages, defined in include/linux/kern_levels.h, along with their meaning:

The following is a list of kernel log levels. Each of these levels corresponds to a number in a string, whose priority is inversely proportional to the value of the number. For example, 0 is higher-priority:

#define KERN_SOH "\001" /* ASCII Start Of Header */ #define KERN_SOH_ASCII '\001' #define KERN_EMERG KERN_SOH "0" /* system is unusable */ #define KERN_ALERT KERN_SOH "1" /* action must be taken immediately ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content