From: Brad Smith Date: Sat, 25 Feb 2023 02:17:16 +0000 (-0500) Subject: Add support for OpenBSD X-Git-Tag: v0.13.4~14 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=020351f306d437ed246ec8373219512a1d905d81;p=userspace-rcu.git 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