[ntp:hackers] ntpd's command-line processing

Harlan Stenn stenn at ntp.isc.org
Mon Jul 11 23:19:48 PDT 2005


I'm working on http://ntp.isc.org/Dev/GNUAutoGenConversion and trying to
understand exactly why we process the command-line arguments twice.

The first time we crack any -d/-D/-l/-L/-n/-N/-q and --* options, then
we fork()/daemonize() (if appropriate), and then reprocess the options
(skipping most of the stuff we have already processed).

There are moments when I think I understand why we need to do this, and
many more where I do not.

I am currently wondering if we cannot do all of the processing first,
then fork()/daemonize() (if appropriate).  We should be able to handle
the debug/logging issues if we are careful about what we close when we
fork().  Maybe.  I'm not sure if there are any issues regarding sockets
when we fork.

If we do need to do this twice, I'm not sure why we need to crack -L
early (but it might well be something in init_io(), which happens before
the second pass).

If you have any information about any of this, please either add it to
the above URL or send me email.



More information about the hackers mailing list