From cefb3327c67d7632fae9a931844671b43b0c2d90 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 29 Jan 2020 16:08:56 +1100 Subject: [PATCH] ctdb-daemon: Pass more information to ctdb_start_daemon() 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 Reviewed-by: Amitay Isaacs --- ctdb/include/ctdb_private.h | 4 +++- ctdb/server/ctdb_daemon.c | 5 ++++- ctdb/server/ctdbd.c | 5 +---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 6aba3c1d48e..de7caef52af 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -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, diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index c4ab2dbc3d3..561d24a189f 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -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); diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 7e71d6e8272..c2dcf7d0606 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -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); -- 2.47.2