1 #ifndef lint 2 static char sccsid[] = "@(#)wwchild.c 3.6 05/08/87"; 3 #endif 4 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 11 #include "ww.h" 12 #include <sys/types.h> 13 #include <sys/wait.h> 14 15 wwchild() 16 { 17 extern errno; 18 int olderrno; 19 register struct ww **wp; 20 union wait w; 21 int pid; 22 23 olderrno = errno; 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; 29 break; 30 } 31 } 32 } 33 errno = olderrno; 34 } 35