From: Brad Smith Date: Sat, 25 Feb 2023 02:17:16 +0000 (-0500) Subject: Add support for OpenBSD X-Git-Url: https://git.lttng.org/?p=userspace-rcu.git;a=commitdiff_plain;h=11f3d1c24e6179abf8247611c5308f41d95389a1 Add support for OpenBSD - Add OpenBSD to syscall compatibility header as appropriate. - Add function for retrieving the thread id in urcu_get_thread_id(). - Rely on pthread cond variables for futex compatibility. It builds on all of our archs and fully run time tested on amd64. Signed-off-by: Brad Smith Signed-off-by: Mathieu Desnoyers Change-Id: I5cca5962ba3dc3113c9bd12e544b6e6f77dfdb61 --- diff --git a/include/urcu/syscall-compat.h b/include/urcu/syscall-compat.h index 23b266e..eaac679 100644 --- a/include/urcu/syscall-compat.h +++ b/include/urcu/syscall-compat.h @@ -33,7 +33,8 @@ #include #elif defined(__CYGWIN__) || defined(__APPLE__) || \ - defined(__FreeBSD__) || defined(__DragonFly__) + defined(__FreeBSD__) || defined(__DragonFly__) || \ + defined(__OpenBSD__) /* Don't include anything on these platforms. */ #else diff --git a/tests/common/thread-id.h b/tests/common/thread-id.h index cb0d903..1e53396 100644 --- a/tests/common/thread-id.h +++ b/tests/common/thread-id.h @@ -68,7 +68,14 @@ unsigned long urcu_get_thread_id(void) pthread_t thr = pthread_self(); return pthread_getsequence_np(&thr); } +#elif defined(__OpenBSD__) +#include +static inline +unsigned long urcu_get_thread_id(void) +{ + return (unsigned long) getthrid(); +} #else # warning "use pid as thread ID" static inline