Re: Q: avoiding zombies
From: Juha Laiho (Juha.Laiho_at_iki.fi)
Date: Wed, 16 Jun 2004 16:47:02 GMT
"James Lehman" <james[remove]@akrobiz.com> said:
>I have written a daemon-like process that controls tape drives.
>I want to be able to start and stop the processes from a CGI application.
>The processes need to run as root, so I came up with an idea of running
>process that does nothing more than wait for the other end of a fifo to
>be opened and written to.
>It works great, except I get a lot of pesky zombies in my process table.
>How do I eliminate this?
Your daemon process either has to install a signal handler for SIGCHLD
in which it calls wait(2)/waitpid(2) for its dead child processes, or
explicitly ignore SIGCHLD signals. See NOTES section at the end of
wait(2) manual page.
I think this is also covered in comp.unix.programmer FAQ material.
-- Wolf a.k.a. Juha Laiho Espoo, Finland (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++ "...cancel my subscription to the resurrection!" (Jim Morrison)