Created
October 31, 2015 02:22
-
-
Save nasitra/6f9da44ee8c13858b5ee to your computer and use it in GitHub Desktop.
Add functions to change kernel log level dynamically
This file contains hidden or 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
| // kernel/kernel/printk.c | |
| static int kmsg_level = 0; | |
| void set_kmsg_lebel(int level) | |
| { | |
| kmsg_level = level; | |
| } | |
| void kmsg_write(const char *fmt, ...) | |
| { | |
| va_list args; | |
| if (kmsg_level != 0) { | |
| va_start(args, fmt); | |
| vprintk(fmt, args); | |
| va_end(args); | |
| } | |
| } |
This file contains hidden or 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
| // kernel/include/linux/printk.h | |
| extern void set_kmsg_lebel(int level); | |
| extern void kmsg_write(const char *fmt, ...); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment