[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250710103630.3156130-1-ben717@andestech.com>
Date: Thu, 10 Jul 2025 18:36:30 +0800
From: Ben Zong-You Xie <ben717@...estech.com>
To:
CC: <tglx@...utronix.de>, <mingo@...hat.com>, <peterz@...radead.org>,
<dvhart@...radead.org>, <dave@...olabs.net>, <andrealmeid@...lia.com>,
<shuah@...nel.org>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <tim609@...estech.com>,
Cynthia Huang
<cynthia@...estech.com>,
Ben Zong-You Xie <ben717@...estech.com>,
"Muhammad
Usama Anjum" <usama.anjum@...labora.com>
Subject: [PATCH v3] selftests: futex: define SYS_futex on 32-bit architectures with 64-bit time_t
From: Cynthia Huang <cynthia@...estech.com>
Linux kernel does not provide sys_futex() on some 32-bit architectures
that do not support 32-bit time representations, such as riscv32.
As a result, glibc cannot define SYS_futex, causing compilation failures
in tests that rely on this syscall. Define SYS_futex as SYS_futex_time64
in such cases to ensure successful compilation and compatibility.
Signed-off-by: Cynthia Huang <cynthia@...estech.com>
Signed-off-by: Ben Zong-You Xie <ben717@...estech.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
Changes since v2:
- Refine the commit message suggested by tglx
- Attribute the authorship to Cynthia
- Add the Reviewed-by tag from Muhammad
v2 : https://lore.kernel.org/all/20250627090812.937939-1-ben717@andestech.com/
Changes since v1:
- Fix the SOB chain
v1 : https://lore.kernel.org/all/20250527093536.3646143-1-ben717@andestech.com/
---
tools/testing/selftests/futex/include/futextest.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/futex/include/futextest.h b/tools/testing/selftests/futex/include/futextest.h
index ddbcfc9b7bac..7a5fd1d5355e 100644
--- a/tools/testing/selftests/futex/include/futextest.h
+++ b/tools/testing/selftests/futex/include/futextest.h
@@ -47,6 +47,17 @@ typedef volatile u_int32_t futex_t;
FUTEX_PRIVATE_FLAG)
#endif
+/*
+ * SYS_futex is expected from system C library, in glibc some 32-bit
+ * architectures (e.g. RV32) are using 64-bit time_t, therefore it doesn't have
+ * SYS_futex defined but just SYS_futex_time64. Define SYS_futex as
+ * SYS_futex_time64 in this situation to ensure the compilation and the
+ * compatibility.
+ */
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
/**
* futex() - SYS_futex syscall wrapper
* @uaddr: address of first futex
--
2.34.1
Powered by blists - more mailing lists