if (!s.foreground)
kill(getppid(), SIGTERM);
+ if (s.daemon_main) {
+ if (!s.daemon_main(&s))
+ failed = 1;
+ goto out;
+ }
+
if (s.daemon_init)
if (!s.daemon_init(&s))
failed = 1;
INFO(&s, "%s waiting for client threads to finish", s.name);
reap(s, 1);
-
+out:
/* If activated by systemd, do not unlink the socket - systemd takes care of that! */
if (!_systemd_activation && s.socket_fd >= 0)
if (unlink(s.socket_path))
handle_request handler;
int (*daemon_init)(struct daemon_state *st);
int (*daemon_fini)(struct daemon_state *st);
+ int (*daemon_main)(struct daemon_state *st);
/* Global runtime info maintained by the framework. */
int socket_fd;