From d540e2f24482e5521e385824af1a574b50149d97 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 15 Jan 2025 14:17:01 -0500 Subject: [PATCH] Add NetBSD support. Signed-off-by: Christos Zoulas Tested-by: Christos Zoulas regtest.out: ============================================================================ Testsuite summary for userspace-rcu 0.15.0 ============================================================================ ============================================================================ TIME=38:58.39 CPU=597.9% (13605.556u 375.860s) SWAPS=0 (157727+3641680)pf (0i+338o) (1Kc+32Kd) short_bench.out: ============================================================================ Testsuite summary for userspace-rcu 0.15.0 ============================================================================ ============================================================================ TIME=1:02:33.91 CPU=716.0% (26438.855u 439.871s) SWAPS=0 (166007+2996145)pf (0i+353o) (0Kc+9Kd) --- include/urcu/syscall-compat.h | 2 +- tests/common/thread-id.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/urcu/syscall-compat.h b/include/urcu/syscall-compat.h index d49b9886..51f3bd66 100644 --- a/include/urcu/syscall-compat.h +++ b/include/urcu/syscall-compat.h @@ -16,7 +16,7 @@ #elif defined(__CYGWIN__) || defined(__APPLE__) || \ defined(__FreeBSD__) || defined(__DragonFly__) || \ - defined(__OpenBSD__) + defined(__OpenBSD__) || defined(__NetBSD__) /* Don't include anything on these platforms. */ #else diff --git a/tests/common/thread-id.h b/tests/common/thread-id.h index 575acaf9..2ee0fd4f 100644 --- a/tests/common/thread-id.h +++ b/tests/common/thread-id.h @@ -67,6 +67,14 @@ unsigned long urcu_get_thread_id(void) { return (unsigned long) getthrid(); } +#elif defined(__NetBSD__) +#include + +static inline +unsigned long urcu_get_thread_id(void) +{ + return (unsigned long) _lwp_self(); +} #else # warning "use pid as thread ID" static inline