From: stmartin@stmart.cxo.dec.com (Andy St Martin)
Subject: Re: How to ignore SIGCLD and not produce zombies?
Date: 1996/09/16 [thread overview]
Message-ID: <51k6r0$76o@nntpd2.cxo.dec.com> (raw)
In-Reply-To: 51c1mr$58s@pt9201.ped.pto.ford.com
In article <51c1mr$58s@pt9201.ped.pto.ford.com>,
Bryan Miller <millerb@ACM.org> wrote:
> I have a server that listens to a well know port and forks
> off children upon request. Since the server cannot wait
> for the children to die before going back to the port to
> listen, it produces defunct (zombie) processes.
>
> Isn't there a way to start the server with SIGCLD set
> to ignore?
If you really don't want to be notified with SIGCLD, you can periodically
call waitpid() to "reap" the exited children.
Something like:
while ((pid = waitpid(-1, &status, WNOHANG)) != -1) {
/* do stuff for cleaning up dead children */
}
This should clean up all the Zombies and not hang if one or more child
processes are still active. This should work for Digital UNIX, Sun
and HP-UX.
Andy St.Martin
stmartin@stmart.cxo.dec.com
next prev parent reply other threads:[~1996-09-16 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-09-13 4:00 How to ignore SIGCLD and not produce zombies? Bryan Miller
1996-09-16 4:00 ` Andy St Martin [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-09-13 4:00 Bryan Miller
1996-09-16 4:00 ` Daniel Lewis
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox