How to clean out Zombies?
Brian Lanier
blanier at lynx.uucp
Sat Jul 21 15:43:38 AEST 1990
In article <24986.26a58a7a at kuhub.cc.ukans.edu> jian at kuhub.cc.ukans.edu writes:
>Help Wanted:
>
> I am writting a program that works like a daemon process. The master
...DELETED...
>call signal is received. Here is the problem. When I use "ps ux" shell
>command to check the status of processes on the system, I found lots of
>Zombie processes. If I terminate the master process, all of zombies are gone.
The problem is that no one is collecting the exit status of the
children, so they just hang out. Init will fix 'em when
they become init's children (i.e. when "Master" dies).
Try including this is the "Master" for a fix:
#include <signal.h>
#include <wait.h>
catcher() /* for zombies */
{
union wait status;
wait3 (&status,WNOHANG,0); /* plain wait will work, too */
}
main()
{
...[misc. code]...
signal(SIGCHLD,catcher);
...[more misc. code]...
}
>
>Thanks in advance.
No Prob, Hope this helps.
>
>Jian Q. Li
>jian at kuhub.cc.ukans.edu
More information about the Comp.unix.questions
mailing list