diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-03-16 05:20:44 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-05-11 04:11:14 -0400 |
commit | d3e6dd2fe73e2c91a5e9803f3d5a93a82fe829ae (patch) | |
tree | 604943deaea410956945d91dff6207351e61c96c /util | |
parent | 68746930ae591eca3d6dd490012b59e85194ede4 (diff) |
main-loop: remove dead code
qemu_add_child_watch is not called anywhere since commit 2bdb920ece
("slirp: simplify fork_exec()", 2019-01-14), remove it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/main-loop.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/util/main-loop.c b/util/main-loop.c index 5188ff6540..d9c55df6f5 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -591,64 +591,3 @@ void event_notifier_set_handler(EventNotifier *e, aio_set_event_notifier(iohandler_ctx, e, false, handler, NULL); } - -/* reaping of zombies. right now we're not passing the status to - anyone, but it would be possible to add a callback. */ -#ifndef _WIN32 -typedef struct ChildProcessRecord { - int pid; - QLIST_ENTRY(ChildProcessRecord) next; -} ChildProcessRecord; - -static QLIST_HEAD(, ChildProcessRecord) child_watches = - QLIST_HEAD_INITIALIZER(child_watches); - -static QEMUBH *sigchld_bh; - -static void sigchld_handler(int signal) -{ - qemu_bh_schedule(sigchld_bh); -} - -static void sigchld_bh_handler(void *opaque) -{ - ChildProcessRecord *rec, *next; - - QLIST_FOREACH_SAFE(rec, &child_watches, next, next) { - if (waitpid(rec->pid, NULL, WNOHANG) == rec->pid) { - QLIST_REMOVE(rec, next); - g_free(rec); - } - } -} - -static void qemu_init_child_watch(void) -{ - struct sigaction act; - sigchld_bh = qemu_bh_new(sigchld_bh_handler, NULL); - - memset(&act, 0, sizeof(act)); - act.sa_handler = sigchld_handler; - act.sa_flags = SA_NOCLDSTOP; - sigaction(SIGCHLD, &act, NULL); -} - -int qemu_add_child_watch(pid_t pid) -{ - ChildProcessRecord *rec; - - if (!sigchld_bh) { - qemu_init_child_watch(); - } - - QLIST_FOREACH(rec, &child_watches, next) { - if (rec->pid == pid) { - return 1; - } - } - rec = g_malloc0(sizeof(ChildProcessRecord)); - rec->pid = pid; - QLIST_INSERT_HEAD(&child_watches, rec, next); - return 0; -} -#endif |