Commit | Line | Data |
---|---|---|
49b6070e | 1 | #ifndef lint |
51e996e1 | 2 | static char sccsid[] = "@(#)wwchild.c 3.6 %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 | 11 | #include "ww.h" |
51e996e1 | 12 | #include <sys/types.h> |
49b6070e EW |
13 | #include <sys/wait.h> |
14 | ||
15 | wwchild() | |
16 | { | |
eec72f58 EW |
17 | extern errno; |
18 | int olderrno; | |
bb05dfb5 | 19 | register struct ww **wp; |
49b6070e EW |
20 | union wait w; |
21 | int pid; | |
49b6070e | 22 | |
eec72f58 | 23 | olderrno = errno; |
bb05dfb5 EW |
24 | while ((pid = wait3(&w, WNOHANG|WUNTRACED, (struct rusage *)0)) > 0) { |
25 | for (wp = wwindex; wp < &wwindex[NWW]; wp++) { | |
26 | if (*wp && (*wp)->ww_state == WWS_HASPROC | |
27 | && (*wp)->ww_pid == pid) { | |
28 | (*wp)->ww_state = WWS_DEAD; | |
49b6070e EW |
29 | break; |
30 | } | |
31 | } | |
49b6070e | 32 | } |
eec72f58 | 33 | errno = olderrno; |
49b6070e | 34 | } |