Commit | Line | Data |
---|---|---|
49b6070e | 1 | #ifndef lint |
60de5df9 | 2 | static char sccsid[] = "@(#)wwchild.c 3.5 %G%"; |
49b6070e EW |
3 | #endif |
4 | ||
60de5df9 EW |
5 | /* |
6 | * Copyright (c) 1983 Regents of the University of California, | |
7 | * All rights reserved. Redistribution permitted subject to | |
8 | * the terms of the Berkeley Software License Agreement. | |
9 | */ | |
10 | ||
49b6070e EW |
11 | #include "ww.h" |
12 | #include <sys/wait.h> | |
13 | ||
14 | wwchild() | |
15 | { | |
eec72f58 EW |
16 | extern errno; |
17 | int olderrno; | |
bb05dfb5 | 18 | register struct ww **wp; |
49b6070e EW |
19 | union wait w; |
20 | int pid; | |
49b6070e | 21 | |
eec72f58 | 22 | olderrno = errno; |
bb05dfb5 EW |
23 | while ((pid = wait3(&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) { |
24 | for (wp = wwindex; wp < &wwindex[NWW]; wp++) { | |
25 | if (*wp && (*wp)->ww_state == WWS_HASPROC | |
26 | && (*wp)->ww_pid == pid) { | |
27 | (*wp)->ww_state = WWS_DEAD; | |
49b6070e EW |
28 | break; |
29 | } | |
30 | } | |
49b6070e | 31 | } |
eec72f58 | 32 | errno = olderrno; |
49b6070e | 33 | } |