tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [RFC] inetd(8) changes proposal



    Date:        Tue, 30 May 2023 16:11:55 +0200
    From:        tlaronde%polynum.com@localhost
    Message-ID:  <ZHYEK1XZZvZsUeyb%polynum.com@localhost>

  | The inclusion directive is a dot i.e. a here script:

Definitely should not be called that, a "here xxx" is an xxx that is,
obviously, here, not elsewhere.   Something in another file is included,
sourced, "dotted" if you like, but not "here".   Of course this is just
a minor terminology issue.


  | -c	check a config file (and does not execute). Returns 0 on success and
  | 	ENOENT or EINVAL on error.

If you mean what that seems to say, then no.  The check only part is fine,
but functions can return ENOENT or EINVAL (or can return -1, or NULL, or
something with one of those in errno) - programs do not exit with those
values as the status (as their values aren't specified, it is possible
that ENOENT%256 (or ENOENT&0xFF if you prefer) == 0.

You can either just exit with status 1, or exit 1 for file open failed
(which covers a whole range of errno values, not just ENOENT), and 2
for invalid contents if you prefer.   But never use errno values as an
exit parameter.

The general outline looks OK to me, but if this happens, and is
documented, try to be a little less long winded in the man page...

One possibility for the config files (and SIGUSR1 etc) might be to
allow a list of config files (with a default list compiled in, possibly with
one name as a fallback always appended to the list) and have
SIGUSR1 move to the next on the list (in one direction) and SIGUSR2
move to the next in the other direction (and SIGHUP just do a reload
on whatever is being used currently, as it always has).

kre



Home | Main Index | Thread Index | Old Index