Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Nov 1995 22:14:54 -0500 (EST)
From:      "Jonathan M. Bresler" <jmb@kryten.Atinc.COM>
To:        Randy Berndt <rberndt@nething.com>
Cc:        Terry Lambert <terry@lambert.org>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Cap'n, there be Zombies here!
Message-ID:  <Pine.3.89.9511192220.B710-0100000@kryten.atinc.com>
In-Reply-To: <199511200300.VAA26624@vellocet.insync.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 19 Nov 1995, Randy Berndt wrote:

> Thanks for the quick reply. No, I'm not reaping (reaping?). I have LIMITED
> experience with the signal() facility. The man page for signal says the 
> default action is 'ignore' for SIGCHLD. Should I set up something that says:
> 
> (void) signal(SIGCHLD, throw_away)
> 
> void throw_away()
> {
> }
> 
> in the part that sets up the fork.

	if you set the signal behavior to SIG_IGN, zombies are never 
created.  the kernel "knows" that the parent will never request the exit 
status of the child and so discards that exit status.

> 
> Also, it is not clear to me if 'execlp' waits for completion before continuing.
> If it does not, maybe the SIGCHLD is coming from execlp to the process that
> quit before it did.

	execlp never returns.  the running process is replaced by the 
exec'ed process.  this is true for all the execxxx() system calls.

	if you fork() and the child then calls execxxx() either the child
or the parent may run to completion first.  if the parent completes and
exits first, the child is inherited by the init process.  if the child
complete and tries to exit, it will become a zombie until the parent calls
one of the waitxx() system calls. 


Jonathan M. Bresler  jmb@kryten.atinc.com       | Analysis & Technology, Inc.  
FreeBSD Postmaster   jmb@FreeBSD.Org            | 2341 Jeff Davis Hwy
play go.                                        | Arlington, VA 22202
ride bike. hack FreeBSD.--ah the good life      | 703-418-2800 x346




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.3.89.9511192220.B710-0100000>