bug fix and using musl-gcc
[rrq/overlay-boot.git] / src / reaper.c
1 /**
2  * This program waits for child process and "reaps" them, i.e. read
3  * off their status so that they can terminate. The program exits when
4  * it runs out of children.
5  */
6 #include <signal.h>
7 #include <string.h>
8 #include <sys/wait.h>
9
10 int main(void) {
11     sigset_t set;
12     siginfo_t status;
13
14     sigfillset(&set);
15     sigprocmask(SIG_BLOCK,&set,NULL);
16
17     do {
18         memset( &status, 0, sizeof( status ) );
19     } while ( waitid( P_ALL, 0, &status, WEXITED ) == 0 );
20     return 0;
21 }