blob: 23f03debfc804b3cbdef7f8e32c87d392ca0b304 (
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>
/*
waitpids_nohang (defined here): only reap pids, don't touch the rest
*/
int waitpids_nohang (pid_t const *pids, unsigned int len, int *wstat)
{
for (unsigned int i = 0 ; i < len ; i++)
{
pid_t r = waitpid_nohang(pids[i], wstat) ;
if (r == -1) return -1-i ;
else if (r == pids[i]) return 1+i ;
}
return 0 ;
}
|