1From e501b7c17ada9c694d3f8302622b78d733485b38 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Sat, 21 Aug 2021 17:55:33 +0200
4Subject: [PATCH] src/util/futex.h: fix build on 32-bit architectures using
5 64-bit time_t
6
7Fix the following build failure on 32-bit architectures using 64-bit
8time_t (e.g. riscv32):
9
10../src/util/futex.h: In function 'sys_futex':
11../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
12   39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
13      |                   ^~~~~~~~~
14      |                   sys_futex
15
16Fixes:
17 - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e
18
19Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
20[Upstream status:
21https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12496]
22---
23 src/util/futex.h | 4 ++++
24 1 file changed, 4 insertions(+)
25
26diff --git a/src/util/futex.h b/src/util/futex.h
27index 43097f4cd5b..221eda9db0c 100644
28--- a/src/util/futex.h
29+++ b/src/util/futex.h
30@@ -34,6 +34,10 @@
31 #include <sys/syscall.h>
32 #include <sys/time.h>
33
34+#ifndef SYS_futex
35+#define SYS_futex SYS_futex_time64
36+#endif
37+
38 static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
39 {
40    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
41--
422.32.0
43
44