linux-printk.c

/*
*  linux/kernel/printk.c
*                                        //--内核中使用的打印函数
*  (C) 1991  Linus Torvalds
*/
/*
* When in kernel-mode, we cannot use printf, as fs is liable to
* point to 'interesting' things. Make a printf with fs-saving, and
* all is well.
*/
#include <stdarg.h>
#include <stddef.h>
#include <linux/kernel.h>
static char buf[1024];
extern int vsprintf(char * buf, const char * fmt, va_list args);
int printk(const char *fmt, ...)
{
    va_list args;
    int i;
    va_start(args, fmt);
    i=vsprintf(buf,fmt,args);
    va_end(args);
    console_print(buf);
    return i;
}
|xGv00|fcc8d4de8197f69fde70263fb4d52380

你可能感兴趣的:(linux-printk.c)