Skip to content

Commit 23b8049

Browse files
committed
pal: Add back checks HAVE_CLOCK_THREAD_CPUTIME
This was removed in #103441 but required for Haiku builds.
1 parent 839a88d commit 23b8049

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

eng/native/tryrun.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|armv6|arm64|loongarch64|riscv64|s39
116116
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
117117
elseif(HAIKU)
118118
set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 1)
119+
set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
119120
set_cache_value(HAVE_PROCFS_STAT_EXITCODE 1)
120121
set_cache_value(HAVE_PROCFS_STATM_EXITCODE 1)
121122
endif()

src/coreclr/pal/src/config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#cmakedefine01 HAVE_CLOCK_MONOTONIC
9393
#cmakedefine01 HAVE_CLOCK_MONOTONIC_COARSE
9494
#cmakedefine01 HAVE_CLOCK_GETTIME_NSEC_NP
95+
#cmakedefine01 HAVE_CLOCK_THREAD_CPUTIME
9596
#cmakedefine01 HAVE_PTHREAD_CONDATTR_SETCLOCK
9697
#cmakedefine01 MMAP_ANON_IGNORES_PROTECTION
9798
#cmakedefine01 ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS

src/coreclr/pal/src/configure.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ int main()
401401
exit((ret == 0) ? 1 : 0);
402402
}" HAVE_CLOCK_GETTIME_NSEC_NP)
403403

404+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_RT_LIBS})
405+
check_cxx_source_runs("
406+
#include <stdlib.h>
407+
#include <time.h>
408+
#include <sys/time.h>
409+
410+
int main()
411+
{
412+
int ret;
413+
struct timespec ts;
414+
ret = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
415+
416+
exit(ret);
417+
}" HAVE_CLOCK_THREAD_CPUTIME)
418+
set(CMAKE_REQUIRED_LIBRARIES)
419+
404420
check_cxx_source_runs("
405421
#include <sys/types.h>
406422
#include <sys/mman.h>

0 commit comments

Comments
 (0)