xref: /original-bsd/usr.bin/window/wwchild.c (revision f82e54c4)
1 #ifndef lint
2 static char sccsid[] = "@(#)wwchild.c	3.4 05/23/84";
3 #endif
4 
5 #include "ww.h"
6 #include <sys/wait.h>
7 
8 wwchild()
9 {
10 	extern errno;
11 	int olderrno;
12 	register struct ww **wp;
13 	union wait w;
14 	int pid;
15 
16 	olderrno = errno;
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;
22 				break;
23 			}
24 		}
25 	}
26 	errno = olderrno;
27 }
28