Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 1 | From 859bfc342d1db9b61c43f30d9aa27cea35ca7599 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 16 Oct 2020 11:03:47 -0700 |
| 4 | Subject: [PATCH] futex.h: Define __NR_futex if it does not exist |
| 5 | |
| 6 | __NR_futex is not defines by newer architectures e.g. arc, riscv32 as |
| 7 | they only have 64bit variant of time_t. Glibc defines SYS_futex interface based on |
| 8 | __NR_futex, since this is used in applications, such applications start |
| 9 | to fail to build for these newer architectures. This patch defines a |
| 10 | fallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps |
| 11 | working |
| 12 | |
| 13 | Upstream-Status: Pending |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 15 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 16 | --- |
| 17 | src/util/futex.h | 4 ++++ |
| 18 | 1 file changed, 4 insertions(+) |
| 19 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 20 | diff --git a/src/util/futex.h b/src/util/futex.h |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 21 | index 2a2a00c..92fc123 100644 |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 22 | --- a/src/util/futex.h |
| 23 | +++ b/src/util/futex.h |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 24 | @@ -38,6 +38,10 @@ |
| 25 | #define SYS_futex SYS_futex_time64 |
| 26 | #endif |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 27 | |
| 28 | +#if !defined(SYS_futex) && defined(SYS_futex_time64) |
| 29 | +# define SYS_futex SYS_futex_time64 |
| 30 | +#endif |
| 31 | + |
| 32 | static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3) |
| 33 | { |
| 34 | return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3); |