src/sys/kern/subr_prf.c
/*
 * Put character in log buffer with a particular priority.
 */
Put character in log buffer with a particular priority.
Put character in log buffer with a particular priority .
static void
msglogchar(int c, int pri)
{
	static int lastpri = -1;
	static int dangling;
	char nbuf[MAXNBUF];
	char *p;
	if (!msgbufmapped)
		return;
	if (c == '\0' || c == '\r')
		return;
	if (pri != -1 && pri != lastpri) {
		if (dangling) {
			msgbuf_addchar(msgbufp, '\n');
			dangling = 0;
		}
		msgbuf_addchar(msgbufp, '<');
		for (p = ksprintn(nbuf, (uintmax_t)pri, 10, NULL, 0); *p;)
			msgbuf_addchar(msgbufp, *p--);
		msgbuf_addchar(msgbufp, '>');
		lastpri = pri;
	}
	msgbuf_addchar(msgbufp, c);
	if (c == '\n') {
		dangling = 0;
		lastpri = -1;
	} else {
		dangling = 1;
	}
}
static void msglogchar ( int c , int pri ) { static int lastpri = -1 ; static int dangling ; char nbuf [ MAXNBUF ] ; char * p ; if ( ! msgbufmapped ) return ; if ( c == ' \0 ' || c == ' \r ' ) return ; if ( pri != -1 && pri != lastpri ) { if ( dangling ) { msgbuf_addchar ( msgbufp , ' \n ' ) ; dangling = 0 ; } msgbuf_addchar ( msgbufp , ' ' ) ; for ( p = ksprintn ( nbuf , ( uintmax_t ) pri , 10 , NULL , 0 ) ; * p ; ) msgbuf_addchar ( msgbufp , * p -- ) ; msgbuf_addchar ( msgbufp , ' ' ) ; lastpri = pri ; } msgbuf_addchar ( msgbufp , c ) ; if ( c == ' \n ' ) { dangling = 0 ; lastpri = -1 ; } else { dangling = 1 ; } }
Put character in log buffer with a particular priority.
Put character in log buffer with a particular priority .