Last active
August 29, 2015 14:04
-
-
Save Aruna-Hewapathirane/98e92eac307e63b2aa73 to your computer and use it in GitHub Desktop.
Digging into printk internals so I truly *understand* what is going on ..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printk is defined as a function in: | |
- arch/ia64/kvm/vmm.c, line 84 | |
- kernel/printk/printk.c, line 1677 // This is what we need for kernel module work | |
1677 asmlinkage __visible int printk(const char *fmt, ...) // char * fmt is a member | |
1678 { // of structure va_format ( shown below ) | |
1679 va_list args; | |
1680 int r; | |
1681 | |
1682 #ifdef CONFIG_KGDB_KDB | |
1683 if (unlikely(kdb_trap_printk)) { | |
1684 va_start(args, fmt); | |
1685 r = vkdb_printf(fmt, args); | |
1686 va_end(args); | |
1687 return r; | |
1688 } | |
1689 #endif | |
1690 va_start(args, fmt); | |
1691 r = vprintk_emit(0, -1, NULL, 0, fmt, args); | |
1692 va_end(args); | |
1693 | |
1694 return r; | |
1695 } | |
1696 EXPORT_SYMBOL(printk); // Symbol is exported so kernel modules can use it | |
51 struct va_format { | |
52 const char *fmt; // used by int printk(const char *fmt, ...) | |
53 va_list *va; | |
54 }; | |
line # 132: | |
int printk(const char *fmt, ...); | |
line # 167: | |
int printk(const char *s, ...) | |
{ | |
return 0; | |
} | |
va_format | |
Defined as a struct type in: | |
Defined as a type in:include/acpi/platform/acenv.h, line 361 | |
359 #ifndef _VALIST | |
360 #define _VALIST | |
361 typedef char *va_list; | |
362 #endif /* _VALIST */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment