]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Pass more information to ctdb_start_daemon()
authorMartin Schwenke <martin@meltin.net>
Wed, 29 Jan 2020 05:08:56 +0000 (16:08 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 10 Feb 2020 04:07:38 +0000 (04:07 +0000)
No functional changes.

This is staging for a change that makes ctdbd fork when test mode is
enabled but interactive is not set.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/include/ctdb_private.h
ctdb/server/ctdb_daemon.c
ctdb/server/ctdbd.c

index 6aba3c1d48e13307ead4c73ac281b1c2832a701b..de7caef52af12533dab955401bc98e9c9e1bda65 100644 (file)
@@ -556,7 +556,9 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb,
 void daemon_tunnel_handler(uint64_t tunnel_id, TDB_DATA data,
                           void *private_data);
 
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork);
+int ctdb_start_daemon(struct ctdb_context *ctdb,
+                     bool interactive,
+                     bool test_mode_enabled);
 
 struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb,
                                                 TALLOC_CTX *mem_ctx,
index c4ab2dbc3d30e68534918974a5fdbbfc1bfdf0b6..561d24a189f5ff01970d097e14c9465d4b846bb9 100644 (file)
@@ -1442,10 +1442,13 @@ static int setup_stdin_handler(struct ctdb_context *ctdb)
 /*
   start the protocol going as a daemon
 */
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
+int ctdb_start_daemon(struct ctdb_context *ctdb,
+                     bool interactive,
+                     bool test_mode_enabled)
 {
        int res, ret = -1;
        struct tevent_fd *fde;
+       bool do_fork = !(interactive || test_mode_enabled);
 
        become_daemon(do_fork, !do_fork, false);
 
index 7e71d6e82725c9c8b3006e6a31966a6becb870e6..c2dcf7d0606d2fee7e35d4ec73542c6591d9dfb7 100644 (file)
@@ -394,11 +394,8 @@ int main(int argc, const char *argv[])
                fast_start = true;
        }
 
-       /* Don't fork when running in test mode */
-       interactive = interactive || test_mode != NULL;
-
        /* start the protocol running (as a child) */
-       return ctdb_start_daemon(ctdb, !interactive);
+       return ctdb_start_daemon(ctdb, interactive, test_mode != NULL);
 
 fail:
        talloc_free(ctdb);