]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] vprintk support
authorMatt Mackall <mpm@selenic.com>
Mon, 23 Aug 2004 05:56:21 +0000 (22:56 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 23 Aug 2004 05:56:21 +0000 (22:56 -0700)
Add vprintk call.  This lets us directly pass varargs stuff to the console
without using vsnprintf to an intermediate buffer.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/kernel.h
kernel/printk.c

index c4c862629d84045268584c27b9af86cf3d74b5b3..a1cf3568a64e8920f0052d5fc821dbe8c17258ca 100644 (file)
@@ -97,6 +97,7 @@ extern int __kernel_text_address(unsigned long addr);
 extern int kernel_text_address(unsigned long addr);
 extern int session_of_pgrp(int pgrp);
 
+asmlinkage int vprintk(const char *fmt, va_list args);
 asmlinkage int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2)));
 
index 8b28dd2b4a98f5bda348eab6523a8a3bc481e504..2162a42c09d296f99ef563826533a569ca4d858b 100644 (file)
@@ -508,6 +508,17 @@ static void zap_locks(void)
 asmlinkage int printk(const char *fmt, ...)
 {
        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;
        int printed_len;
        char *p;
@@ -521,9 +532,7 @@ asmlinkage int printk(const char *fmt, ...)
        spin_lock_irqsave(&logbuf_lock, flags);
 
        /* Emit the output into the temporary buffer */
-       va_start(args, fmt);
        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
@@ -575,6 +584,7 @@ out:
        return printed_len;
 }
 EXPORT_SYMBOL(printk);
+EXPORT_SYMBOL(vprintk);
 
 /**
  * acquire_console_sem - lock the console system for exclusive use.