diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-05-08 12:34:17 +0200 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2009-06-09 11:38:49 +0100 |
commit | 7c3370d4fe3fa6cda8655f109e4659afc8ca4269 (patch) | |
tree | 681f9d6d086927c0804fc83e7185790cf9085471 /vl.c | |
parent | c27ff60871aff588a35e51d1a90faed410993e55 (diff) | |
download | qemu-7c3370d4fe3fa6cda8655f109e4659afc8ca4269.zip qemu-7c3370d4fe3fa6cda8655f109e4659afc8ca4269.tar.gz qemu-7c3370d4fe3fa6cda8655f109e4659afc8ca4269.tar.bz2 |
slirp: Avoid zombie processes after fork_exec
Slirp uses fork_exec for spawning service processes, and QEMU uses this
for running smbd. As SIGCHLD is not handled, these processes become
zombies on termination. Fix this by installing a proper signal handler,
but also make sure we disable the signal while waiting on forked network
setup/shutdown scripts.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -4783,7 +4783,12 @@ static void termsig_handler(int signal) qemu_system_shutdown_request(); } -static void termsig_setup(void) +static void sigchld_handler(int signal) +{ + waitpid(-1, NULL, WNOHANG); +} + +static void sighandler_setup(void) { struct sigaction act; @@ -4792,6 +4797,10 @@ static void termsig_setup(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); } #endif @@ -5918,7 +5927,7 @@ int main(int argc, char **argv, char **envp) #ifndef _WIN32 /* must be after terminal init, SDL library changes signal handlers */ - termsig_setup(); + sighandler_setup(); #endif /* Maintain compatibility with multiple stdio monitors */ |