Commit | Line | Data |
---|---|---|
49b6070e | 1 | #ifndef lint |
7edc52ec | 2 | static char sccsid[] = "@(#)wwchild.c 3.4 %G%"; |
49b6070e EW |
3 | #endif |
4 | ||
5 | #include "ww.h" | |
6 | #include <sys/wait.h> | |
7 | ||
8 | wwchild() | |
9 | { | |
eec72f58 EW |
10 | extern errno; |
11 | int olderrno; | |
bb05dfb5 | 12 | register struct ww **wp; |
49b6070e EW |
13 | union wait w; |
14 | int pid; | |
49b6070e | 15 | |
eec72f58 | 16 | olderrno = errno; |
bb05dfb5 EW |
17 | while ((pid = wait3(&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) { |
18 | for (wp = wwindex; wp < &wwindex[NWW]; wp++) { | |
19 | if (*wp && (*wp)->ww_state == WWS_HASPROC | |
20 | && (*wp)->ww_pid == pid) { | |
21 | (*wp)->ww_state = WWS_DEAD; | |
49b6070e EW |
22 | break; |
23 | } | |
24 | } | |
49b6070e | 25 | } |
eec72f58 | 26 | errno = olderrno; |
49b6070e | 27 | } |