Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2001 17:19:27 +0200 (EET)
From:      diman <diman@asd-g.com>
To:        mouss <usebsd@free.fr>
Cc:        diwil@eis.ru, freebsd-hackers@FreeBSD.ORG
Subject:   Re: warning in free():
Message-ID:  <Pine.BSF.4.21.0102231522080.289-100000@portal.none.ua>
In-Reply-To: <4.3.0.20010222194459.0242d850@pop.free.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, 22 Feb 2001, mouss wrote:

> At 18:37 22/02/01 +0200, diman wrote:
> 
> >Open AF_UNIX socket to syslogd and then use err_set_file()
> >to redirect all err/warn messages to syslogd instead of
> >stdin/stdout. That should help you debug daemons.
> 
> I agree, but one of the nice things about syslog interface is that it hides
> all the socket/device stuff. so getting back to the socket api is
> somewhat unsatisfactory.

Yes, it's a bit dirty workaround. But openlog() returns void.
Returning pointer to a structure from wich I can obtain file 
descriptor has more sense for several reasons. It would be nice
to be able get current LogFile, LogTag, LogStat and LogFacility
from openlog().

> 
> Also, I think having this directly in err() and warn() and friends would be
> more elegant. and this doesn't seem hard to do. something like using
> a function pointer to use fprintf or syslog, and an additionnal void* to use
> either err_file or syslog priority.
> 
> Does this sound ok or is it an unuseful complication of code?

I see a sense in your words. Linking a daemon with a libs wich will
break control connection by diagnostic messages is not a dream.
Having that messages on the console and in the log file is
helpful under debug time. There are some points:

 1. If daemon want syslog, it should use syslog().
 2. If daemon want warn and exit, it should use warnx.
 3. If it doesn't want stderr, it should use err_set_file.

*4. If daemon doesn't want libc talking to remote end and
    breaking a control connection or daemon doesn't want 
    remote end to know about internal fault, it should
    be able to redirect libc output.
*5. Daemon feels good to syslog above libc messages
*6. To do 5 it would be nice to have ERR_TO_SYSLOG reserved
    integer for the err_set_file(void* vfp). So,

   	err_set_file ( ERR_TO_SYSLOG ) ;

    will say libc to use LogFile and current syslog context
    to write all err/warn messages instead of stderr.

*7. Approach described above doesn't break any current
    app/daemons and nothing have to be rewritten because
    ERR_TO_SYSLOG is 0xfffffffa (for example). Approach
    is trivial to implement.

 8. Not linked well to the speach but openlog() should
    not return void but pointer to the struct with
    LogFile, LogTag, LogStat and LogFacility fields.


    That is my view of the subject.
    Best Regards, diman.


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?Pine.BSF.4.21.0102231522080.289-100000>