log file vs fork
Hal Murray
halmurray at sonic.net
Sun Aug 22 05:46:48 UTC 2021
setup_logfile() in libntp/msyslog.c says:
* This routine is invoked three different times in the sequence of a
* typical daemon ntpd with DNS lookups to do. First it is invoked in
* the original ntpd process, then again in the daemon after closing
* all descriptors. In both of those cases, ntp.conf has not been
* processed, so only -l/--logfile will trigger logfile redirection in
* those invocations. Finally, if DNS names are resolved, the worker
* child invokes this routine after its fork and close of all
* descriptors. In this case, ntp.conf has been processed and any
* "logfile" directive needs to be honored in the child as well.
That says "fork" and "DNS" in the same sentence.
The DNS code now uses a thread. The only fork() is in ntpd.c
I assume the above comment is out of date.
Please sing out if there is something interesting going on.
The NTS_KE server also uses threads.
Can somebody give me a lesson in why a program should close all it's
descriptors?
We can clean up a lot of crufty code if we drop that.
--
These are my opinions. I hate spam.
More information about the devel
mailing list