blob: 9f26b5dbfac02723637bd4907c98305dc813eea0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* ISC license. */
#include <sys/wait.h>
#include <skalibs/djbunix.h>
int waitn_reap (pid_t *pids, unsigned int len)
{
unsigned int n = 0 ;
while (len)
{
int w ;
int r = wait_pids_nohang(pids, len, &w) ;
if (r < 0) return r ;
else if (!r) break ;
pids[r-1] = pids[--len] ;
n++ ;
}
return n ;
}
|