From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,782002c31f9c8f6c X-Google-Attributes: gidfee84,public From: patchkov@acs1.acs.ucalgary.ca (Serguei Patchkovskii) Subject: Re: Zombies are haunting me! HELP! Date: 1998/05/28 Message-ID: <6kk3t6$jau@ds2.acs.ucalgary.ca>#1/1 X-Deja-AN: 357348774 References: <6ken58$9e0@examiner.concentric.net> Organization: The University of Calgary Newsgroups: comp.unix.osf.osf1 Steve VanDevender (stevev@hexadecimal.uoregon.edu) wrote: : 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 Quite simply, this assertion is wrong if taken literally. If the parent process is not interested in the child's exit codes, it is possible to arrange for dead children to be disposed of without parent's interverntion. The sigaction(2) manual page provides all the gory details, but in practice doing: struct sigaction action ; action.sa_handler = SIG_IGN ; action.sa_mask = 0 ; action.sa_flags = SA_NOCLDSTOP|SA_NOCLDWAIT ; sigaction( SIGCHLD, &action, NULL ) ; will make waiting for your childs not necessary. (It is still possible to synchronize with the children processes, see wait(2) and sigaction(2) manual pages). On some other unices (e.g. AIX), simply setting SIGCHLD to SIG_IGN by doing signal(SIGCHLD,SIG_IGN) will have the same effect. On Digital Unix, the same behaviour can be obtained by linking with system V compatibility library (-lsys5), even though I cannot find any references to this in the manual pages. Linking either with bsd signals library, or with the default libc handler will result in zombies. As usual, there is more than one way to skin a cat. /Serge.P