home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!mcdchg!mcdphx!mre
- From: mre@phx.mcd.mot.com (Mark Enstone)
- Subject: Re: Which Child?
- Message-ID: <1993Jan6.223823.15038@phx.mcd.mot.com>
- Keywords: child fork
- Sender: news@phx.mcd.mot.com
- Nntp-Posting-Host: tacheon.phx.mcd.mot.com
- Organization: Motorola Computer Group, Tempe, Az.
- References: <C0Fyxx.ABn@cerc.wvu.wvnet.edu>
- Date: Wed, 6 Jan 1993 22:38:23 GMT
- Lines: 33
-
- In article <C0Fyxx.ABn@cerc.wvu.wvnet.edu> abmg@cerc.wvu.wvnet.edu (Aliasghar Babadi) writes:
- >Hi,
- > I have a program which forks several child processes. If one
- >child is terminated. Is there a way to findout which child has been
- >terminated? Thanks.
-
- wait(2)
-
- "and if a child process stopped or terminated prior to the call on wait,
- return is immediate."
-
- "If wait returns due to a stopped or terminated child process, the process
- ID of the child is returned to the calling process. Otherwise, a value of
- -1 is returned and errno is set to indicate the error."
-
- Therefore, what you're after is the return value from wait (&stat_loc)
- system call.
-
- All sorts of other good stuff are returned in stat_loc. May I perhaps suggest
- RTM on the wait(2) system call.
-
- You're welcome,
-
- - mark
- A.k.a. ,,,
- (o o)
- +------------------------------oOO--(_)--OOo-----------------------------------+
- | Mark Enstone | |
- | Motorola Inc., | uucp : mre@phx.mcd.mot.com |
- | Fault Tolerant Computing | phone: (602) 438 3284 |
- | 2900 South Diablo Way, DW220 | fax : (602) 438 3836 |
- | Tempe, Arizona 85282, USA | icbm : mid-southwestern US desert |
- +------------------------------------+-----------------------------------------+
-