Path: utzoo!attcan!uunet!husc6!rutgers!gatech!mcdchg!usenet From: paul@morganucodon.cis.ohio-state.edu (Paul Placeway) Newsgroups: comp.unix Subject: Re: Children's exit() status Message-ID: <10324@mcdchg.UUCP> Date: 13 Jun 88 18:17:54 GMT References: <4626@mcdchg.UUCP> <7967@mcdchg.UUCP> <10105@mcdchg.UUCP> Sender: usenet@mcdchg.UUCP Organization: The Ohio State University Dept of Computer and Information Science Lines: 19 Approved: usenet@mcdchg.UUCP In article <10105@mcdchg.UUCP> daveb@laidbak.UUCP (Dave Burton) writes: < Actually, this is more effort than is required. < wait(2) will return a -1 and set errno to ECHILD if there are no more < children to wait() on. So a simple loop will work: < < while (wait(&status) != -1 || errno != ECHILD) < ; /* check status here if desired */ Ah yes, but what if you want to catch all of your exited children, you might still have running children, and you _don't_ want to wait(2) for them too? Under BSD you could do that as: while (wait3(&status, WNOHANG, NULL) != -1 || errno != ECHILD) { /* stuff */ } But what about USG? --Paul