From a7cf2454ddbd3844068ae7d85e67f969a97122b3 Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin Date: Sun, 5 May 2024 13:09:22 +0200 Subject: [PATCH] BUILD: clock: improve check for pthread_getcpuclockid() if _POSIX_THREAD_CPUTIME is greater than 0, pthread_getcpuclockid() is implemented. This should fix the build on Solaris 11. Reference: https://docs.oracle.com/cd/E88353_01/html/E37842/unistd-3head.html ML: https://www.mail-archive.com/haproxy@formilux.org/msg44915.html --- src/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clock.c b/src/clock.c index ec2133c8b..7734389a7 100644 --- a/src/clock.c +++ b/src/clock.c @@ -135,7 +135,7 @@ uint64_t now_cpu_time_thread(int thr) /* set the clock source for the local thread */ void clock_set_local_source(void) { -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME) +#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) #ifdef USE_THREAD pthread_getcpuclockid(pthread_self(), &per_thread_clock_id[tid]); #else