Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 1998 18:26:05 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        tlambert@primenet.com (Terry Lambert)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: default syslog priority for kernel messages
Message-ID:  <199809030126.SAA07413@bubba.whistle.com>
In-Reply-To: <199809030036.RAA00192@usr07.primenet.com> from Terry Lambert at "Sep 3, 98 00:36:14 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert writes:
> > > The only problem is that it's possible to printf from the kernel
> > > without logging, and it may frequently be desirable to send a message
> > > to the console without logging it.
> > 
> > So then kill syslogd.
> > 
> > Here is the comment in the code:
> > 
> >   /*
> >    * 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.
> >    */     
> 
> The printf calls are special-use calls.  They are not merely the "printf"
> that you think should be "log".  The "printf" is merely a wrapper for
> "kvprintf".
> 
> Instead of putting "log" in those places, if you got rid of "printf",
> the correct thing to do would be to call "kvprintf" (not "log").

It depends on what the code writer wanted. I'd say in 99% of the cases,
they want to spit out a normal kernel logging message and have it go
to syslogd. That's exactly what log() does.

The only time I can imagine when you would want kprintf() is if you're
doing some debugging with tons & tons of output, or something like that.

So in the common case, the right thing to do is replace printf with log.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809030126.SAA07413>