1 printk(KERN_XXX "message");
2 Notar a falta de vírgula. A macro expande para <X>, onde X é um número.
3 Isso é interpretado por klogd (ou libc - man klogctl).
5 Da mesma manpage, também em include/linux/kernel.h:
6 #define KERN_EMERG "<0>" /* system is unusable */
7 #define KERN_ALERT "<1>" /* action must be taken immediately */
8 #define KERN_CRIT "<2>" /* critical conditions */
9 #define KERN_ERR "<3>" /* error conditions */
10 #define KERN_WARNING "<4>" /* warning conditions */
11 #define KERN_NOTICE "<5>" /* normal but significant condition */
12 #define KERN_INFO "<6>" /* informational */
13 #define KERN_DEBUG "<7>" /* debug-level messages */
15 printk_once - macro que imprime apenas uma vez
16 printk_ratelimit - if (printk_ratelimit()) { } - limite por função
17 imprime no máximo 10 vezes em 5 segundos, parâmetros configuráveis
18 /proc/sys/kernel/printk_ratelimit{,_burst}
20 printk_ratelimited(fmt, ...) - valores padrões apenas
24 Ainda em include/linux/kernel.h
33 pr_devel -- apenas se macro DEBUG definida
34 pr_debug -- apenas se macro DEBUG definida, ou com dynamic_debug
38 #include <linux/device.h>
39 dev_printk(level, device, fmt, ...);
40 dev_emerg(device, fmt, ...);
47 dev_dbg -- apenas se macro DEBUG definida, ou com dynamic_debug
51 dynamic_debug - precisa de DEBUG_FS
52 ver em lib/Kconfig.debug e Documentation/dynamic-debug-howto.txt
56 Definição de DEBUG condicionada ao Kconfig.
57 drivers/usb/core/Kconfig
58 drivers/usb/core/Makefile
60 ifeq ($(CONFIG_USB_DEBUG),y)
61 EXTRA_CFLAGS += -DDEBUG
64 Se aplica apenas ao makefile em que é definido.