Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!babcock.cerc.wvu.wvnet.edu From: vrm@babcock.cerc.wvu.wvnet.edu (Vasile R. Montan) Newsgroups: comp.lang.c Subject: Re: Catching termination of child process and system() call Message-ID: <1232@babcock.cerc.wvu.wvnet.edu> Date: 24 Jan 91 19:13:51 GMT References: <1991Jan24.084230.12153@cai.uucp> Sender: news@cerc.wvu.wvnet.edu Distribution: comp.lang.c Lines: 34 From article <1991Jan24.084230.12153@cai.uucp>, by davel@cai.uucp (David W. Lauderback): > However, if you are just trying to get rid of left-over child processes > "zombie processes", > just use: > signal(SIGCHLD,SIG_IGN); > instead of: > signal(SIGCHLD, dowait); > and you need no wait. (see signal(2) or signal(3c) in BSD) > > FYI: The zombie process is storing the child process' exit status, so must > remain until its parent process has read this information. SIG_IGN to SIGCHLD > states this process' child's return value should be discarded. I have seen this solution proposed many times, but it doesn't work for me. I am using a Sun4 SunOS4.1. I have created the following test routine. Maybe someone could tell me if I am doing something wrong or if it is the operating system. #include main() { int i; signal(SIGCHLD, SIG_IGN); for (i=0; i< 10; i++) { if (! fork()) exit (0); } while (1) {} } It generates 10 children, which immediately exit then it waits in an infinite loop. When I do a "ps", I see all 10 processes hanging around.