Article View: comp.unix
Article #536Re: Children's exit() status
From: Paul Placeway
Date: Mon, 13 Jun 1988 18:17
Date: Mon, 13 Jun 1988 18:17
19 lines
1131 bytes
1131 bytes
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
Technical Details
Message-ID:
<10324@mcdchg.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!rutgers!gatech!mcdchg!usenetReferences:
<4626@mcdchg.UUCP> <7967@mcdchg.UUCP> <10105@mcdchg.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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