*BSD News Article 79528


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!swidir.switch.ch!serra.unipi.it!nntp.zit.th-darmstadt.de!fu-berlin.de!news.mathworks.com!newsfeed.internetmci.com!in3.uu.net!quack!quack.kfu.com!nsayer
From: nsayer@quack.kfu.com (Nick Sayer)
Subject: Re: What is a zombie?
Message-ID: <nAN1whJ@quack.kfu.com>
Sender: news@quack.kfu.com (0000-News(0000))
Organization: The Duck Pond public unix, +1 408 249 9630, log in as guest.
References: <52a5dt$qef@vixen.cso.uiuc.edu> <3249D8F7.2EA39DDA@lambert.org> <52jtk1$8s@uriah.heep.sax.de>
Date: Mon, 30 Sep 1996 05:09:48 UTC
Lines: 23

j@uriah.heep.sax.de (J Wunsch) writes:


>Implementing SA_NOCLDWAIT for sa_flags in sigaction(2) would be the
>way to go, but nobody has done this so far in FreeBSD.  So your only
>chance is to actually install the d*mn signal handler, and have it
>fetch the exit status of the child.

The only time it's a problem is when a program does a lot of forking. If
it does, and you don't care about the child, put this line in right
before the fork():

while(waitpid(-1,NULL,WNOHANG));

This will reap any existing zombies, discarding any status (you could
replace NULL with a status pointer and handle the status in the while
loop if you want.

-- 
Nick Sayer <nsayer@quack.kfu.com>  | "Stimpy! Move your butt! It's a
N6QQQ @ N0ARY.#NORCAL.CA.USA.NOAM  | higher mammal!"
+1 408 249 9630, log in as 'guest' | 
URL: http://www.kfu.com/~nsayer/   | 	      -- Ren