Re: Ignoring SIGHUP when becoming a daemon?

From: Rich Teer (rich.teer_at_rite-group.com)
Date: 05/23/03


Date: Fri, 23 May 2003 04:35:21 GMT

On Fri, 23 May 2003, Rich Teer wrote:

> I've written a function to make the caller into a daemon
> on Solaris, and the behaviour is the same with or without
> ignoring SIGHUP. Right now, I'm planning to leave out the
> ignoring of SIGHUP.

Sorry to follow up to myself, but I've got it sussed, thanks
to Andrew Gierth's FAQ (I should've known this already, but
it's getting late). Anyway, here's the pertinent info:

        * When the process that dies is the session leader of a session that is
        attached to a terminal device, SIGHUP is sent to all processes in the
        foreground process group of that terminal device.

So, once a daemon has called setsid() (and therefore lost its
controlling terminal), the other processes will NOT be sent a
SIGHUP.

-- 
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net