blob: 3c52e6bae7fb8240af735d2e10689b5060310623 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* ISC license. */
#include <sys/types.h>
#include <skalibs/djbunix.h>
int wait_pids_nohang (pid_t const *pids, unsigned int len, int *wstat)
{
for (;;)
{
int w ;
register pid_t r = wait_nohang(&w) ;
if (!r || (r == (pid_t)-1)) return (int)r ;
{
register unsigned int i = 0 ;
for (; i < len ; i++) if (r == pids[i]) break ;
if (i < len)
{
*wstat = w ;
return 1+i ;
}
}
}
}
|