sd_event_source* sigterm;
sd_event_source* sigint;
sd_event_source* sighup;
+ sd_event_source* sigchld;
sd_event_source* init;
sd_event_source* exit;
} events;
return collecty_queue_flush(self->queue);
}
+static int collecty_daemon_SIGCHLD(sd_event_source* source,
+ const struct signalfd_siginfo* si, void* data) {
+ return 0;
+}
+
static int collecty_daemon_setup_loop(collecty_daemon* self) {
int r;
return r;
}
+ // Listen for SIGCHLD
+ r = sd_event_add_signal(self->loop, &self->events.sighup,
+ SIGCHLD|SD_EVENT_SIGNAL_PROCMASK, collecty_daemon_SIGCHLD, self);
+ if (r < 0) {
+ ERROR(self->ctx, "Could not register handling SIGCHLD: %s\n", strerror(-r));
+ return r;
+ }
+
// Initialize the daemon when the loop starts
r = sd_event_add_defer(self->loop, &self->events.init,
collecty_daemon_init, self);
}
static void collecty_daemon_free(collecty_daemon* self) {
+ if (self->events.sigchld)
+ sd_event_source_unref(self->events.sigchld);
if (self->events.sigterm)
sd_event_source_unref(self->events.sigterm);
if (self->events.sigint)