Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!mcnc!rti!xyzzy!duncan From: duncan@dg-rtp.dg.com (W. Lee Duncan) Newsgroups: comp.unix.questions Subject: Re: Need help spawning a child Message-ID: <7449@xyzzy.UUCP> Date: 30 Jun 89 13:44:09 GMT References: <1661@apt.UUCP> Sender: usenet@xyzzy.UUCP Reply-To: duncan@rtp48.dg.com (W. Lee Duncan) Distribution: usa Organization: Data General Corporation, Research Triangle Park, NC Lines: 43 In article <1661@apt.UUCP> brian@apt.UUCP (Brian Litzinger) writes of needing to creating asynchronous children and not having his process table filled up. Try orphaning your children (sounds mean, doesn't it). Just do something like: void create_an_orphaned_process() { int pid1, pid2; if ((pid1 = fork()) < 0) end_all_life("no need to live"); if (pid1 == 0) { /* the child -- it'll fork and die */ if (pid2 = fork()) < 0) end_all_thought_of_life("why me"); if (pid2 == 0) { exec("some grandchild program"); end_all_sentient_life("shouldn't get here"); } else exit(0); /* the child is no longer needed */ } return; /* the original process goes on its merry way */ } /* end function */ > ><> Brian Litzinger @ APT Technology Inc., San Jose, CA ><> UUCP: {apple,sun,pyramid}!daver!apt!brian brian@apt.UUCP ><> VOICE: 408 370 9077 FAX: 408 370 9291 > -- W. Lee Duncan, Data General, RTP - "How can you be two places at once UUCP: {world}!mcnc!rti!dg-rtp!duncan - when you're really no place at all?" DOMAIN: duncan@dg-rtp.dg.com - Firesign Theatre