]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- fast-reload, compile without threads.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 21 Mar 2024 12:17:34 +0000 (13:17 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 21 Mar 2024 12:17:34 +0000 (13:17 +0100)
daemon/remote.c
testdata/fast_reload_fwd.tdir/fast_reload_fwd.pre
testdata/fast_reload_thread.tdir/fast_reload_thread.pre

index 1a90822dd548a4c7732c2871162af96edc5c1094..7a82b3e3cfb9d8c92897b6eccc94d14bbf87013d 100644 (file)
@@ -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
 }
 
index e418fd2139fd5a023ea2b362281c51a828e94108..2fb705e74ce3dd5210588831e299a0fe72b3766c 100644 (file)
@@ -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))
index 5f23204e50b4cc3e9d273f72a65331f0e3ac964c..5521742fa3189f275dfc89fbd34bd678d32b8ea8 100644 (file)
@@ -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