Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!luth!sunic!sics.se!uplog.se!uplog.uplog.se!thomas From: thomas@uplog.se (Thomas Tornblom) Newsgroups: comp.unix.wizards Subject: Re: forking and zombies in SYSV. Message-ID: Date: 20 Aug 90 14:33:01 GMT References: <1990Aug19.210351.24632@dde.dk> <1990Aug20.133107.12516@lth.se> Sender: thomas@uplog.se (Thomas Tornblom) Organization: TeleLOGIC Uppsala AB Lines: 42 In-Reply-To: jh@efd.lth.se's message of 20 Aug 90 13:31:07 GMT In article <1990Aug20.133107.12516@lth.se> jh@efd.lth.se (Joergen Haegg) writes: A question about how to fork() in SYSV. I want to fork, and the parentprocess should continue without doing a wait(). When the child exits, it is transformed into a zombieprocess. The zombie exists until the parent exits. This is as it should be according to SVID. How do I avoid getting this zombie? The only way, am I told, is to let the child fork again and exit. The parent will wait() for the first child, but not the child of the first child. The second child will not create a zombie, because the parent (the first child) is dead. This seems a bit silly, because /etc/init forks all the time and without any zombies. (Ok, init is maybe a little special :-) Is there not a cleaner way to do this? -- -- Joergen Haegg jh@efd.lth.se postmaster@efd.lth.se System manager @ efd 046-107492 Lund Institute of Technology Sweden In the parent do a: signal(SIGCLD, SIG_IGN); this prevents the creation of a zombie without having to do anything in the child. Thomas -- Real life: Thomas Tornblom Email: thomas@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden