]> sourceware.org Git - lvm2.git/commitdiff
libdaemon: allow main processing function to be specified
authorDavid Teigland <teigland@redhat.com>
Tue, 2 Dec 2014 20:08:58 +0000 (14:08 -0600)
committerDavid Teigland <teigland@redhat.com>
Tue, 23 Jun 2015 21:55:45 +0000 (16:55 -0500)
libdaemon/server/daemon-server.c
libdaemon/server/daemon-server.h

index bedd3b239790e5159a2e765285f2a64c0575c9a5..ef0b96491f49f2791a474589e06a7327eec2e8ef 100644 (file)
@@ -604,6 +604,12 @@ void daemon_start(daemon_state s)
        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;
@@ -635,7 +641,7 @@ void daemon_start(daemon_state s)
 
        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))
index 820e5e042ff26118a765441123eb92e2bf7dbf16..b235edce6b06f67b26e8529a6fc39ea31340f104 100644 (file)
@@ -107,6 +107,7 @@ typedef struct daemon_state {
        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;
This page took 0.038358 seconds and 5 git commands to generate.