]> git.itanic.dy.fi Git - rrdd/commitdiff
process: Remove signal handler completely
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 11:09:40 +0000 (14:09 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 11:09:40 +0000 (14:09 +0300)
There is no need for this at all any more. This was only used for
reaping the childs on the fork based concurrency management. Now that
threads are doing forking on the same namespace, threads that are
expecting signals might get confused when the main thread handles the
sigchld signal on behalf of the thread. Remove the handler completely
to avoid any confusion.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
process.c

index ae13277269dd4f68016fe7995a859bbd166ff70f..fd87b1f88dc2b3255954489870b0d1ace66c071a 100644 (file)
--- a/process.c
+++ b/process.c
@@ -189,28 +189,6 @@ int get_parent_count(void)
        return parent_count;
 }
 
-static int handle_signals(struct event_handler *h)
-{
-       struct signalfd_siginfo siginfo;
-       int ret;
-
-       ret = read(h->fd, &siginfo, sizeof(siginfo));
-       if (ret < sizeof(siginfo)) {
-               pr_err("Expected %zd from read, got %d: %m\n",
-                       sizeof(siginfo), ret);
-               return -1;
-       }
-
-       if (siginfo.ssi_signo != SIGCHLD) {
-               pr_err("Unexpected signal %d, ignoring\n", siginfo.ssi_signo);
-               return -1;
-       }
-
-       harvest_zombies(siginfo.ssi_pid);
-
-       return 0;
-}
-
 static int grant_new_job(void)
 {
        int ret;
@@ -289,12 +267,6 @@ static int handle_job_request(struct event_handler *h)
        return 0;
 }
 
-struct event_handler signal_handler = {
-       .handle_event = handle_signals,
-       .events = EPOLLIN,
-       .name = "signal",
-};
-
 struct event_handler job_request_handler = {
        .handle_event = handle_job_request,
        .events = EPOLLIN,
@@ -340,14 +312,6 @@ int init_jobcontrol(int max_jobs_requested)
        sigemptyset(&sigmask);
        sigaddset(&sigmask, SIGCHLD);
 
-       signal_handler.fd = signalfd(-1, &sigmask, SFD_CLOEXEC);
-       if (job_request_handler.fd < 0) {
-               pr_err("Failed to create signal_fd: %m\n");
-               return -1;
-       }
-
-       register_event_handler(&signal_handler);
-
        if (max_jobs_requested > 0) {
                max_jobs = max_jobs_requested;
                goto no_count_cpus;