Subject: Re: CVS commit: src/bin/sh (trap.c:1.32)
To: None <current-users@netbsd.org>
From: Geoff Wing <mason@primenet.com.au>
List: current-users
Date: 07/12/2005 15:12:13
Christos Zoulas <christos@astron.com> typed:
:>This means that when /etc/rc finishes, any spawned processes which weren't
:>explicitly nohup'd or otherwise will receive a HUP and exit.
: This was not really intended. On the other hand, /etc/rc is not setting
: a trap handler for HUP so hup should remain blocked for everything started
: from /etc/rc, except for programs that explicitly enable it. Isn't that
: the case?

I've had a long, tedious, expensive trip home because a prior train hit/killed
someone so this may be not exactly correct (and I'm making it up on the spot
from memory and doing it in semi djb-style obfuscation):

void foo(int bar){fprintf(stderr,"BAZ: %d\n",bar);}
main(){int i=0;for(;i<32;i++){signal(i,foo);};do{sleep(99);}while(i);}

Add this blah program to /etc/rc.local as, say, (blah&)

and examine whereever you expect output to end up (I redirected mine)
and see output:  BAZ: 1
or something like that. BTW, signal(7) says SIGHUP = terminate process

Regards,
Geoff