]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: debug: do not check the isolated_thread variable in non-threaded builds
authorWilly Tarreau <w@1wt.eu>
Sun, 7 May 2023 13:02:30 +0000 (15:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 7 May 2023 13:02:30 +0000 (15:02 +0200)
The build without thread support was broken by commit b30ced3d8 ("BUG/MINOR:
debug: fix incorrect profiling status reporting in show threads") because
it accesses the isolated_thread variable that is not defined when threads
are disabled. In fact both the test on harmless and this one make no sense
without threads, so let's comment out the block and mark the related
variables as unused.

This may have to be backported to 2.7 if the commit above is.

src/debug.c

index ce9d44cd6bc2c82c440ce997462dc7ef15b7e57a..8d87530cc631211dbe7caef70cbd896f2cb6c5e9 100644 (file)
@@ -183,11 +183,11 @@ void ha_backtrace_to_stderr(void)
 void ha_thread_dump_one(int thr, int from_signal)
 {
        struct buffer *buf = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].thread_dump_buffer);
-       unsigned long thr_bit = ha_thread_info[thr].ltid_bit;
+       unsigned long __maybe_unused thr_bit = ha_thread_info[thr].ltid_bit;
+       int __maybe_unused tgrp  = ha_thread_info[thr].tgid;
        unsigned long long p = ha_thread_ctx[thr].prev_cpu_time;
        unsigned long long n = now_cpu_time_thread(thr);
        int stuck = !!(ha_thread_ctx[thr].flags & TH_FL_STUCK);
-       int tgrp  = ha_thread_info[thr].tgid;
 
        chunk_appendf(buf,
                      "%c%cThread %-2u: id=0x%llx act=%d glob=%d wq=%d rq=%d tl=%d tlsz=%d rqsz=%d\n"
@@ -208,10 +208,12 @@ void ha_thread_dump_one(int thr, int from_signal)
                      stuck,
                      !!(ha_thread_ctx[thr].flags & TH_FL_TASK_PROFILING));
 
+#if defined(USE_THREAD)
        chunk_appendf(buf,
                      " harmless=%d isolated=%d",
                      !!(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit),
                      isolated_thread == thr);
+#endif
 
        chunk_appendf(buf, "\n");
        chunk_appendf(buf, "             cpu_ns: poll=%llu now=%llu diff=%llu\n", p, n, n-p);