add a service to reap zombies, use it in SLIRP

SLIRP -smb support wants to fork a process and forget about reaping it.
To please it, add a generic service to register a process id and let
QEMU reap it.  In the future it could be enhanced to pass a status,
but this would be unused.

With this in place, the SIGCHLD signal handler would not stomp on pclose
anymore.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Paolo Bonzini 2011-03-09 18:21:10 +01:00 committed by Anthony Liguori
parent 0298141998
commit 4d54ec7898
4 changed files with 69 additions and 10 deletions

View file

@ -67,11 +67,6 @@ static void termsig_handler(int signal, siginfo_t *info, void *c)
qemu_system_killed(info->si_signo, info->si_pid);
}
static void sigchld_handler(int signal)
{
waitpid(-1, NULL, WNOHANG);
}
void os_setup_signal_handling(void)
{
struct sigaction act;
@ -82,10 +77,6 @@ void os_setup_signal_handling(void)
sigaction(SIGINT, &act, NULL);
sigaction(SIGHUP, &act, NULL);
sigaction(SIGTERM, &act, NULL);
act.sa_handler = sigchld_handler;
act.sa_flags = SA_NOCLDSTOP;
sigaction(SIGCHLD, &act, NULL);
}
/* Find a likely location for support files using the location of the binary.