aboutsummaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-03-09 18:21:10 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-03-29 08:14:11 -0500
commitbe35fbe4b39be466b92487f0fb3ef4ad549f0f09 (patch)
tree2e5ce287614343ec99c99bd17b86052ba551a86b /misc.c
parent512eba6859a0b5fedc871cd349d8b78584472a5e (diff)
downloadslirp-be35fbe4b39be466b92487f0fb3ef4ad549f0f09.zip
slirp-be35fbe4b39be466b92487f0fb3ef4ad549f0f09.tar.gz
slirp-be35fbe4b39be466b92487f0fb3ef4ad549f0f09.tar.bz2
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>
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index b4697a4..e4cf46b 100644
--- a/misc.c
+++ b/misc.c
@@ -112,6 +112,7 @@ int 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);
@@ -135,7 +136,8 @@ int 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);
@@ -201,6 +203,7 @@ int 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;