head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2026.11.23.10.29.52; author adam; state Exp; branches; next ; commitid iRvtCaPzqXxxxz4H; desc @@ 1.1 log @mesa: added version 26.2.7 The Mesa project began as an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics. Over the years the project has grown to implement more graphics APIs, including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API, XvMC and Vulkan. A variety of device drivers allows the Mesa libraries to be used in many different environments ranging from software emulation to complete hardware acceleration for modern GPUs. @ text @$NetBSD$ * Add futex support functions for NetBSD. --- src/util/futex.c.orig 2026-10-23 06:41:48.873423635 +0000 +++ src/util/futex.c @@@@ -151,6 +151,38 @@@@ int futex_wait(uint32_t *addr, int32_t value, const st return GetLastError() == ERROR_TIMEOUT ? ETIMEDOUT : -1; } +#elif defined(__NetBSD__) +#include +#include +#include +#include + +static int futex(uint32_t *uaddr, int op, int val, const struct timespec *timeout, + int *uaddr2, int val3) +{ + return syscall(SYS___futex, uaddr, op, val, timeout, uaddr2, val3); +} + +int futex_wake(uint32_t *addr, int32_t count) +{ + return futex(addr, FUTEX_WAKE, count, NULL, NULL, 0); +} + +int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout) +{ + struct timespec tsnow, tsrel; + + if (timeout == NULL) + return futex(addr, FUTEX_WAIT, value, NULL, NULL, 0); + + clock_gettime(CLOCK_MONOTONIC, &tsnow); + if (timespeccmp(&tsnow, timeout, <)) + timespecsub(timeout, &tsnow, &tsrel); + else + timespecclear(&tsrel); + return futex(addr, FUTEX_WAIT, value, &tsrel, NULL, 0); +} + #else #error UTIL_FUTEX_SUPPORTED is not implemented but the header told it is supported on this platform #endif @