From: Steve VanDevender <stevev@hexadecimal.uoregon.edu>
Subject: Re: Zombies are haunting me! HELP!
Date: 1998/05/27 [thread overview]
Message-ID: <x7ogwjmngx.fsf@hexadecimal.uoregon.edu> (raw)
In-Reply-To: 6ken58$9e0@examiner.concentric.net
clark@knowideas.com (William Clark) writes:
> Hello there,
>
> I am writing c code on a DEC Alpha box running DEC Unix.
>
> I have created a daemon that forks a child to receive a file
> from a remote process.
>
> Everything works great EXCEPT that I am collecting a zombie
> for each terminated child process.
>
> I am using the signal function with SIGCHLD,SIG_IGN params before
> I start the loop that waits for a sockets connection and forks
> the child.
>
> I thought that would prevent zombies.
>
> Any ideas would be appreciated. Thanks in advance.
>
> billc
Quite simply, the parent must issue a wait() system call for each
child that it forks. A child will remain in a zombie state until
the parent collects its exit status with wait() (or wait3() or
wait4(); see "man 2 wait" for additional information). Ignoring
SIGCHLD will not prevent zombies; in fact, it will be more likely
to preserve them. Normally you would want to catch SIGCHLD and
issue a wait() from in the signal handler if you want to be able
to handle child exits asynchronously.
--
Steve VanDevender "I ride the big iron" http://jcomm.uoregon.edu/~stevev
stevev@hexadecimal.uoregon.edu PGP keyprint 4AD7AF61F0B9DE87 522902969C0A7EE8
"bash awk grep perl sed df du, du-du du-du,
vi troff su fsck rm * halt LART LART LART!" -- the Swedish BOFH
next prev parent reply other threads:[~1998-05-27 4:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-26 4:00 Zombies are haunting me! HELP! William Clark
1998-05-27 4:00 ` news.encomix.es
1998-05-27 4:00 ` Steve VanDevender [this message]
1998-05-28 4:00 ` Serguei Patchkovskii
1998-05-28 4:00 ` Jeff Denham
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