Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!athena.mit.edu!vlcek From: vlcek@athena.mit.edu (Jim C Vlcek) Newsgroups: comp.unix.questions Subject: Re: spawning a child by double forking Message-ID: <12453@bloom-beacon.MIT.EDU> Date: 6 Jul 89 01:31:34 GMT References: <12376@bloom-beacon.MIT.EDU> <1668@apt.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: vlcek@athena.mit.edu (Jim C Vlcek) Organization: Massachusetts Institute of Technology Lines: 23 Double-forking to avoid creating zombies or having to wait on children just don't sit right with me. You fork() because you need another process, not because you want to hide your trail from something. It's like bringing two cars on a trip just in case one gets a flat: why go to all that trouble just to avoid bringing a spare? Brian Litzinger, in <1668@apt.UUCP>, sez: ``Ignoring SIGCLD is a wonderful solution for people running System V. Unfortunately, ignoring SIGCHLD in most BSD systems will not produce the same result.'' ``The reasoning behind the double forking is that it is a more portable solution than ignoring SIGCLD.'' Steve Summit (I think) recommended trapping SIGC(H)LD (at least our version of 4.3BSD #defines SIGCHLD SIGCLD), and then waiting on the expiring child, as a portable solution. This seems to me far better than double-forking, and doubtless faster. One has the added bonus of having the exit status of the children easily available -- just in case you want them later. Jim Vlcek (vlcek@caf.mit.edu uunet!mit-caf!vlcek)