-sigchld_handler(int signr UNUSED)
-{
- struct process *p;
-
- COVERAGE_INC(process_sigchld);
- LIST_FOR_EACH (p, struct process, node, &all_processes) {
- if (!p->exited) {
- int retval, status;
- do {
- retval = waitpid(p->pid, &status, WNOHANG);
- } while (retval == -1 && errno == EINTR);
- if (retval == p->pid) {
- p->exited = true;
- p->status = status;
- } else if (retval < 0) {
- /* XXX We want to log something but we're in a signal
- * handler. */
- p->exited = true;
- p->status = -1;
- }
- }
- }
- write(fds[1], "", 1);
-}
-
-static bool
-is_member(int x, const int *array, size_t n)
-{
- size_t i;
-
- for (i = 0; i < n; i++) {
- if (array[i] == x) {
- return true;
- }
- }
- return false;
-}
-
-static bool
-sigchld_is_blocked(void)
-{
- sigset_t sigs;
- if (sigprocmask(SIG_SETMASK, NULL, &sigs)) {
- ovs_fatal(errno, "sigprocmask");
- }
- return sigismember(&sigs, SIGCHLD);
-}
-
-static void
-block_sigchld(sigset_t *oldsigs)