From d915c4c076fdd2ed6b671300cfa735c31cdece82 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 21 Mar 2024 13:17:34 +0100 Subject: [PATCH] - fast-reload, compile without threads. --- daemon/remote.c | 12 +++++++++++- testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre | 8 ++++++++ .../fast_reload_thread.tdir/fast_reload_thread.pre | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/daemon/remote.c b/daemon/remote.c index 1a90822dd..7a82b3e3c 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -678,9 +678,16 @@ do_reload(RES* ssl, struct worker* worker, int reuse_cache) static void do_fast_reload(RES* ssl, struct worker* worker, struct rc_state* s) { +#ifdef THREADS_DISABLED + if(!ssl_printf(ssl, "error: no threads for fast_reload, compiled without threads.\n")) + return; + (void)worker; + (void)s; +#else if(!ssl_printf(ssl, "start fast_reload\n")) return; fast_reload_thread_start(ssl, worker, s); +#endif } /** do the verbosity command */ @@ -3522,6 +3529,7 @@ fr_notification_to_string(enum fast_reload_notification status) return "unknown"; } +#ifndef THREADS_DISABLED /** fast reload, poll for notification incoming. True if quit */ static int fr_poll_for_quit(struct fast_reload_thread* fr) @@ -3642,7 +3650,6 @@ fr_send_notification(struct fast_reload_thread* fr, } } -#ifndef THREADS_DISABLED /** fast reload thread queue up text string for output */ static int fr_output_text(struct fast_reload_thread* fr, const char* msg) @@ -5252,6 +5259,7 @@ int fast_reload_client_callback(struct comm_point* ATTR_UNUSED(c), void* arg, return 0; } +#ifndef THREADS_DISABLED /** fast reload printq create */ static struct fast_reload_printq* fr_printq_create(struct comm_point* c, struct worker* worker) @@ -5270,6 +5278,7 @@ fr_printq_create(struct comm_point* c, struct worker* worker) printq->client_cp->cb_arg = printq; return printq; } +#endif /* !THREADS_DISABLED */ /** fast reload printq delete */ static void @@ -5432,6 +5441,7 @@ fast_reload_thread_start(RES* ssl, struct worker* worker, struct rc_state* s) ub_thread_create(&worker->daemon->fast_reload_thread->tid, fast_reload_thread_main, worker->daemon->fast_reload_thread); #else + (void)s; #endif } diff --git a/testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre b/testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre index e418fd213..2fb705e74 100644 --- a/testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre +++ b/testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre @@ -4,7 +4,15 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test +PRE="../.." . ../common.sh +# if no threads; exit +if grep -e "define HAVE_PTHREAD 1" -e "define HAVE_SOLARIS_THREADS 1" -e "define HAVE_WINDOWS_THREADS 1" $PRE/config.h; then + echo "have threads" +else + skip_test "no threads" +fi + get_random_port 3 UNBOUND_PORT=$RND_PORT NS1_PORT=$(($RND_PORT + 1)) diff --git a/testdata/fast_reload_thread.tdir/fast_reload_thread.pre b/testdata/fast_reload_thread.tdir/fast_reload_thread.pre index 5f23204e5..5521742fa 100644 --- a/testdata/fast_reload_thread.tdir/fast_reload_thread.pre +++ b/testdata/fast_reload_thread.tdir/fast_reload_thread.pre @@ -4,7 +4,15 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test +PRE="../.." . ../common.sh +# if no threads; exit +if grep -e "define HAVE_PTHREAD 1" -e "define HAVE_SOLARIS_THREADS 1" -e "define HAVE_WINDOWS_THREADS 1" $PRE/config.h; then + echo "have threads" +else + skip_test "no threads" +fi + get_random_port 1 UNBOUND_PORT=$RND_PORT echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test -- 2.47.2