Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 384 → Rev 385

/shark/trunk/kernel/printk.c
36,11 → 36,11
*/
 
/*
* CVS : $Id: printk.c,v 1.2 2002-10-28 07:56:49 pj Exp $
* CVS : $Id: printk.c,v 1.3 2004-01-08 20:14:08 giacomo Exp $
*
* File: $File$
* Revision: $Revision: 1.2 $
* Last update: $Date: 2002-10-28 07:56:49 $
* Revision: $Revision: 1.3 $
* Last update: $Date: 2004-01-08 20:14:08 $
*/
 
#include <ll/i386/cons.h>
52,6 → 52,8
 
static int printklevel=0;
 
#define NO_LEVEL 100
 
static char *levelname[]={
"emerg ",
"alert ",
65,27 → 67,27
 
static int vprintk(int flag, char *fmt, va_list ap)
{
static char buf[1024]; /* DANGER !!!!! */
static char buf[2048]; /* DANGER !!!!! */
SYS_FLAGS f;
int level;
int result;
result=sscanf(fmt,"<%i>",&level);
if (result==1) {
level = NO_LEVEL;
if (*fmt == '<' && *(fmt+2) == '>')
level = *(fmt+1) - '0';
if (level != NO_LEVEL) {
if (level<LOG_EMERG||level>LOG_DEBUG) level=LOG_INFO;
fmt+=3;
} else {
level=LOG_INFO;
}
if (level<=printklevel) return 0;
vsprintf(buf,(char*)fmt,ap);
result=(strchr(fmt,'\n')!=NULL);
 
f=kern_fsave();
cprintf("[%s] %s",levelname[level],buf);
/* if we called printk, and the string does not have a \n in it, add it */
if ((!flag)&&(!result)) cprintf("\n");
if (level != NO_LEVEL)
cprintf("[%s] %s",levelname[level],buf);
else
cprintf("%s",buf);
kern_frestore(f);
return 0;