From 1c334debecd70bd28e61a36c40c3f96cf5467331 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 10 Sep 2024 03:12:38 -0400 Subject: [PATCH] [llvm][Support] Determine the max thread length on Haiku (#107801) Haiku has pthread_setname_np() / pthread_getname_np(). --- llvm/lib/Support/Unix/Threading.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc index 43e18c3a963abf..0afd1d817f88e6 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -55,6 +55,10 @@ #include // For syscall() #endif +#if defined(__HAIKU__) +#include // For B_OS_NAME_LENGTH +#endif + namespace llvm { pthread_t llvm_execute_on_thread_impl(void *(*ThreadFunc)(void *), void *Arg, @@ -139,6 +143,8 @@ uint64_t llvm::get_threadid() { static constexpr uint32_t get_max_thread_name_length_impl() { #if defined(PTHREAD_MAX_NAMELEN_NP) return PTHREAD_MAX_NAMELEN_NP; +#elif defined(__HAIKU__) + return B_OS_NAME_LENGTH; #elif defined(__APPLE__) return 64; #elif defined(__sun__) && defined(__svr4__)