From 66b7ba52b7b49cb712c337b934440049ab94454b Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 27 Jun 2020 21:14:44 -0400 Subject: [PATCH] Add OpenBSD support to be able to retrieve the thread id --- 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 5c1bfc5..9c1f116 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -37,6 +37,10 @@ #include // For _lwp_self() #endif +#if defined(__OpenBSD__) +#include // For getthrid() +#endif + #if defined(__linux__) #include // For sched_getaffinity #include // For syscall codes @@ -105,6 +109,8 @@ uint64_t llvm::get_threadid() { return uint64_t(pthread_getthreadid_np()); #elif defined(__NetBSD__) return uint64_t(_lwp_self()); +#elif defined(__OpenBSD__) + return uint64_t(getthrid()); #elif defined(__ANDROID__) return uint64_t(gettid()); #elif defined(__linux__) -- 2.7.4