src/util/futex.h: fix build on 32-bit architectures using 64-bit time_t
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sat, 21 Aug 2021 15:55:33 +0000 (17:55 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 3 May 2022 16:40:22 +0000 (16:40 +0000)
Fix the following build failure on 32-bit architectures using 64-bit
time_t (e.g. riscv32):

../src/util/futex.h: In function 'sys_futex':
../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
   39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
      |                   ^~~~~~~~~
      |                   sys_futex

Fixes:
 - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12496>

src/util/futex.h

index 43097f4..221eda9 100644 (file)
 #include <sys/syscall.h>
 #include <sys/time.h>
 
+#ifndef SYS_futex
+#define SYS_futex SYS_futex_time64
+#endif
+
 static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
 {
    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);