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

Danny Mayer mayer at gis.net
Tue Jul 12 08:25:10 PDT 2005

Harlan Stenn wrote:
> Folks,
> 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).
The -L option is needed immediately because the current implementation 
reads the interface info first and sets up the sockets. The config file 
is read later. However, the changes that I implemented when I added that 
as well as some other security features now allow you to change things 
on the fly which should allows us to make changes based on the config 
file as well as dynamically through remote requests.


> If you have any information about any of this, please either add it to
> the above URL or send me email.
> Thanks...
> H
> _______________________________________________
> hackers mailing list
> hackers at support.ntp.org
> https://support.ntp.org/mailman/listinfo/hackers

More information about the hackers mailing list