From: deraadt Date: Mon, 23 Oct 2023 20:40:24 +0000 (+0000) Subject: create __OpenBSD__ versions that use futex() with the correct number X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0022d6e3231bccf80815371839f7c9d76b71add;p=openbsd create __OpenBSD__ versions that use futex() with the correct number of arguments and without using syscall(). the glibc people should be ashamed of the mess they created. ok miod --- diff --git a/gnu/llvm/libcxxabi/src/cxa_guard_impl.h b/gnu/llvm/libcxxabi/src/cxa_guard_impl.h index 6f873f241fa..5ca4c571563 100644 --- a/gnu/llvm/libcxxabi/src/cxa_guard_impl.h +++ b/gnu/llvm/libcxxabi/src/cxa_guard_impl.h @@ -395,7 +395,20 @@ private: // Futex Implementation //===----------------------------------------------------------------------===// -#if defined(SYS_futex) +#ifdef __OpenBSD__ +#include + +void PlatformFutexWait(int* addr, int expect) { + constexpr int WAIT = 0; + futex((volatile uint32_t *)addr, WAIT, expect, NULL, NULL); + __tsan_acquire(addr); +} +void PlatformFutexWake(int* addr) { + constexpr int WAKE = 1; + __tsan_release(addr); + futex((volatile uint32_t *)addr, WAKE, INT_MAX, NULL, NULL); +} +#elif defined(SYS_futex) void PlatformFutexWait(int* addr, int expect) { constexpr int WAIT = 0; syscall(SYS_futex, addr, WAIT, expect, 0);