Yo Hal!

On Mon, 21 Mar 2016 23:25:00 -0700
Hal Murray <hmur...@megapathdsl.net> wrote:

> g...@rellim.com said:
> > Check out "man 7 signal", almost nothing is legal to call from
> > within a signal.  You can't even open() of fopen() anything.  About
> > the best you can do is write(STDERR,) and exit().   
> 
> Right.  I was wondering if there was any software that would check
> that.

Well, there is some wetware that can do that.  Or better yet, as the
man page says, just don't use signal().

> For ntpd, writing to STDERR doesn't work since it's a daemon and has
> nuked STDOUT and STDERR.  syslog(3) isn't on the approved list.

Ain't it a bitch.

> The call restrictions mean that you can't longjmp out of a signal
> unless you know you were't doing anything dangerous when the signal
> went off.  After the jump, you are still in the signal handler.

Yup.  The best you can do is set a flag and return.

> On the other hand, it mostly works

Yeah, be sure to put that in your man page: It mostly works.

> so all sorts of web pages show you
> how to do it without mentioning the restrictions.  In the case of
> ntpq, it's likely to be doing a DNS lookup.

DNS lookups time out in 5 or 10 seconds, so easy to just set a flag and
return, then let the main loop commit suicide with dignity.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        g...@rellim.com  Tel:+1 541 382 8588

Attachment: pgpZP7nd05SLk.pgp
Description: OpenPGP digital signature

_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to