mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdaemon: allow main processing function to be specified
This commit is contained in:
parent
ba2b701f2c
commit
c5ba60827e
@ -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))
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user