Subject: Re: CVS commit: src/bin/sh (trap.c:1.32)
To: None <current-users@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: current-users
Date: 07/14/2005 18:42:23
On Tue, Jul 12, 2005 at 03:12:13PM +0000, Geoff Wing wrote:
> 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

Geoff,

This explains why one of my daemons goes away directly after /etc/rc
finishes, thanks.  (It didn't used to do that!)

Christos, maybe that should be "Don't hard ignore signals that were
ignored by our environment ..." after a trap is set?

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933