]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: clock: improve check for pthread_getcpuclockid()
authorIlia Shipitsin <chipitsine@gmail.com>
Sun, 5 May 2024 11:09:22 +0000 (13:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 May 2024 06:25:17 +0000 (08:25 +0200)
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

index ec2133c8b9e39733e2ad69db7368280242a90ec3..7734389a71831f76551e28cbf481750f4f45cf94 100644 (file)
@@ -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