Commit 683b2292 authored by Matt Mackall's avatar Matt Mackall Committed by Linus Torvalds

[PATCH] vprintk support

Add vprintk call.  This lets us directly pass varargs stuff to the console
without using vsnprintf to an intermediate buffer.
Signed-off-by: default avatarMatt Mackall <mpm@selenic.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 87ff5642
...@@ -97,6 +97,7 @@ extern int __kernel_text_address(unsigned long addr); ...@@ -97,6 +97,7 @@ extern int __kernel_text_address(unsigned long addr);
extern int kernel_text_address(unsigned long addr); extern int kernel_text_address(unsigned long addr);
extern int session_of_pgrp(int pgrp); extern int session_of_pgrp(int pgrp);
asmlinkage int vprintk(const char *fmt, va_list args);
asmlinkage int printk(const char * fmt, ...) asmlinkage int printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2))); __attribute__ ((format (printf, 1, 2)));
......
...@@ -508,6 +508,17 @@ static void zap_locks(void) ...@@ -508,6 +508,17 @@ static void zap_locks(void)
asmlinkage int printk(const char *fmt, ...) asmlinkage int printk(const char *fmt, ...)
{ {
va_list args; va_list args;
int r;
va_start(args, fmt);
r = vprintk(fmt, args);
va_end(args);
return r;
}
asmlinkage int vprintk(const char *fmt, va_list args)
{
unsigned long flags; unsigned long flags;
int printed_len; int printed_len;
char *p; char *p;
...@@ -521,9 +532,7 @@ asmlinkage int printk(const char *fmt, ...) ...@@ -521,9 +532,7 @@ asmlinkage int printk(const char *fmt, ...)
spin_lock_irqsave(&logbuf_lock, flags); spin_lock_irqsave(&logbuf_lock, flags);
/* Emit the output into the temporary buffer */ /* Emit the output into the temporary buffer */
va_start(args, fmt);
printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args); printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args);
va_end(args);
/* /*
* Copy the output into log_buf. If the caller didn't provide * Copy the output into log_buf. If the caller didn't provide
...@@ -575,6 +584,7 @@ asmlinkage int printk(const char *fmt, ...) ...@@ -575,6 +584,7 @@ asmlinkage int printk(const char *fmt, ...)
return printed_len; return printed_len;
} }
EXPORT_SYMBOL(printk); EXPORT_SYMBOL(printk);
EXPORT_SYMBOL(vprintk);
/** /**
* acquire_console_sem - lock the console system for exclusive use. * acquire_console_sem - lock the console system for exclusive use.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment