Early use of log() does not end up in kernel msg buffer

John Baldwin jhb at freebsd.org
Wed Apr 8 16:12:18 UTC 2015


On Monday, April 06, 2015 09:11:21 PM Poul-Henning Kamp wrote:
> --------
> In message <2033248.Eu3RHS8lTG at ralph.baldwin.cx>, John Baldwin writes:
> 
> >I think phk@ broke this back in 70239.  Before that the log() function did
> >this:
> >
> >log()
> >{
> >
> >	/* log to the msg buffer */
> >	kvprintf(fmt, msglogchar, ...);
> >
> >	if (!log_open) {
> >		/* log to console */
> >		kvprintf(fmt, putchar, ...);
> >	}
> >}
> >
> >I think your patch is fine unless phk@ (cc'd) has a reason for not wanting to
> >do this.
> 
> The reason was systems not running syslog having slow serial consoles.

To be clear, you didn't turn off printing to the console, you turned off
writing to the msglog.

That is, before your change:

- If syslog wasn't running, the message was sent to the msglog (so that a
  subsequently started syslog would see it) and to the console.
- If syslog was running, the message was only sent to the msglog, but not
  the console.

After your change:

- If syslog isn't running, the message is only sent to the console.
- If syslog is running, the message is only sent to the msglog.

The direct result is that less data is sent to the msglog.  Is the concern
that when syslogd starts up any pre-boot log messages can be sent over the
console a second time by the syslogd process writing to /dev/console?

Note that this does mean that any messages logged before syslogd are lost
and cannot be accessed by any software on the box that wants to do parse
syslogd output, etc. (which is what is probably causing problems for the
OP).

-- 
John Baldwin


More information about the freebsd-current mailing list