Add support for OpenBSD
authorBrad Smith <brad@comstyle.com>
Sat, 25 Feb 2023 02:17:16 +0000 (21:17 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 25 Feb 2023 14:43:53 +0000 (09:43 -0500)
- 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 <brad@comstyle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5cca5962ba3dc3113c9bd12e544b6e6f77dfdb61

include/urcu/syscall-compat.h
tests/common/thread-id.h

index 23b266ef561875a59e4bba9e2dfc83c7a44a3928..eaac6790057362fc6c276168dee65b45940c0536 100644 (file)
@@ -33,7 +33,8 @@
 #include <syscall.h>
 
 #elif defined(__CYGWIN__) || defined(__APPLE__) || \
-       defined(__FreeBSD__) || defined(__DragonFly__)
+       defined(__FreeBSD__) || defined(__DragonFly__) || \
+       defined(__OpenBSD__)
 /* Don't include anything on these platforms. */
 
 #else
index cb0d903748b1d0ddf2fd6b7c8a219d10f917896c..1e533966895aa1e747f45b38ed52fd123852ca52 100644 (file)
@@ -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 <unistd.h>
 
+static inline
+unsigned long urcu_get_thread_id(void)
+{
+       return (unsigned long) getthrid();
+}
 #else
 # warning "use pid as thread ID"
 static inline
This page took 0.027333 seconds and 4 git commands to generate.