From 4d54ec7898bd951007cb6122d5315584bd41d0c4 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 9 Mar 2011 18:21:10 +0100 Subject: 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 Signed-off-by: Anthony Liguori --- slirp/misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'slirp') diff --git a/slirp/misc.c b/slirp/misc.c index 19dbec4..08eba6a 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -119,6 +119,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) char *bptr; const char *curarg; int c, i, ret; + pid_t pid; DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %lx", (long)so); @@ -142,7 +143,8 @@ fork_exec(struct socket *so, const char *ex, int do_pty) } } - switch(fork()) { + pid = fork(); + switch(pid) { case -1: lprint("Error: fork failed: %s\n", strerror(errno)); close(s); @@ -206,6 +208,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) exit(1); default: + qemu_add_child_watch(pid); if (do_pty == 2) { close(s); so->s = master; -- cgit v1.1