Date: Tue, 02 Oct 2001 20:55:07 +0900 From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> To: phk@freebsd.org, current@freebsd.org Cc: yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: log(9) bug? or feature? Message-ID: <200110021155.UAA10794@zodiac.mech.utsunomiya-u.ac.jp>
next in thread | raw e-mail | index | archive | help
In /sys/kern/subr_prf.c rev 1.66 and earlier, log(9) printed the message to the log buffer if the log buffer is being read by a process (syslogd). If no process is reading the log buffer, the message went to BOTH the log buffer and the console, as documented in the comment just above log(9). /* * Log writes to the log buffer, and guarantees not to sleep (so can be * called by interrupt routines). If there is no process reading the * log yet, it writes to the console also. */ void log(int level, const char *fmt, ...) { [...] In rev 1.67 and later, the message goes to the log buffer only if a process is reading the log buffer. If no process is reading, the message goes to the console ONLY, and it is not put into the log buffer. This behavior is inconsistent with the above comment. Is this a bug introduced in rev 1.67, or is it the intended new behavior and the comment is out of date? The following patch will print the message to BOTH the log buffer and the console if no process is reading the log buffer. Kazu Index: subr_prf.c =================================================================== RCS file: /src/CVS/src/sys/kern/subr_prf.c,v retrieving revision 1.72 diff -u -r1.72 subr_prf.c --- subr_prf.c 12 Sep 2001 08:37:45 -0000 1.72 +++ subr_prf.c 2 Oct 2001 11:37:31 -0000 @@ -194,7 +196,7 @@ pca.tty = NULL; pca.pri = level; - pca.flags = log_open ? TOLOG : TOCONS; + pca.flags = log_open ? TOLOG : (TOLOG | TOCONS); va_start(ap, fmt); retval = kvprintf(fmt, putchar, &pca, 10, ap); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110021155.UAA10794>