blob: e7d92197bea4a025924eb187c7cb1f2fba2effea [file] [log] [blame]
From 859bfc342d1db9b61c43f30d9aa27cea35ca7599 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 16 Oct 2020 11:03:47 -0700
Subject: [PATCH] futex.h: Define __NR_futex if it does not exist
__NR_futex is not defines by newer architectures e.g. arc, riscv32 as
they only have 64bit variant of time_t. Glibc defines SYS_futex interface based on
__NR_futex, since this is used in applications, such applications start
to fail to build for these newer architectures. This patch defines a
fallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps
working
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/util/futex.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/util/futex.h b/src/util/futex.h
index 2a2a00c..92fc123 100644
--- a/src/util/futex.h
+++ b/src/util/futex.h
@@ -38,6 +38,10 @@
#define SYS_futex SYS_futex_time64
#endif
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+# 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);