Messages in this thread Patch in this message | | | Date | Mon, 15 Jun 2009 21:16:57 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] WARN(): add a \n to the message printk |
| |
On Mon, 15 Jun 2009, Linus Torvalds wrote: > > And no, this does not necessarily fix Arjan's problem: it only adds the > newline before printk's that _do_ have a KERN_<lvl> format. So now, in > order to get the extra '\n' after the WARN_ON() line, somebody needs to > make sure that the printk's in the warning printing have loglevels. > > Arjan?
The "print_modules()" function needs a KERN_WARNING in front of it.
Or something like this (on top of the patch I just sent out), which allows you to specify loglevel that is just the default one, whatever that happens to be. Using KERN_DEFAULT, of course.
Hmm?
Linus
--- include/linux/kernel.h | 2 ++ kernel/module.c | 2 +- kernel/printk.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 066bb1e..1b2e174 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -97,6 +97,8 @@ extern const char linux_proc_banner[]; #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ +/* Use the default kernel loglevel */ +#define KERN_DEFAULT "<d>" /* * Annotation for a "continued" line of log printout (only done after a * line that had no enclosing \n). Only to be used by core/arch code diff --git a/kernel/module.c b/kernel/module.c index e4ab36c..215aaab 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2899,7 +2899,7 @@ void print_modules(void) struct module *mod; char buf[8]; - printk("Modules linked in:"); + printk(KERN_DEFAULT "Modules linked in:"); /* Most callers should already have preempt disabled, but make sure */ preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) diff --git a/kernel/printk.c b/kernel/printk.c index a87770c..b4d97b5 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -696,6 +696,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) switch (c) { case '0' ... '7': /* loglevel */ current_log_level = c - '0'; + /* Fallthrough - make sure we're on a new line */ + case 'd': /* KERN_DEFAULT */ if (!new_text_line) { emit_log_char('\n'); new_text_line = 1;
| |