ctdb-event: Add support to eventd for the startup notification FD
authorMartin Schwenke <martin@meltin.net>
Fri, 24 Aug 2018 04:52:29 +0000 (14:52 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 30 Aug 2018 02:48:56 +0000 (04:48 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13592

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/event/event_daemon.c

index 63c4dad2866276574bf2eb93fc3fb31bef1b553c..c1c6852cca543df48ea3ffbf9eb246cc4a84d93c 100644 (file)
@@ -218,14 +218,18 @@ static bool event_client_recv(struct tevent_req *req, int *perr)
 
 static struct {
        int pid;
+       int startup_fd;
 } options = {
        .pid = -1,
+       .startup_fd = -1,
 };
 
 struct poptOption cmdline_options[] = {
        POPT_AUTOHELP
        { "pid", 'P', POPT_ARG_INT, &options.pid, 0,
                "pid to wait for", "PID" },
+       { "startup-fd", 'S', POPT_ARG_INT, &options.startup_fd, 0,
+               "file descriptor to notify of successful start", "FD" },
        POPT_TABLEEND
 };
 
@@ -338,6 +342,10 @@ int main(int argc, const char **argv)
                goto fail;
        }
 
+       if (options.startup_fd != -1) {
+               sock_daemon_set_startup_fd(e_state->sockd, options.startup_fd);
+       }
+
        ret = sock_daemon_run(e_state->ev,
                              e_state->sockd,
                              e_state->pidfile,