Skip to content

Commit 0485081

Browse files
cynthia0928KAGA-KOKO
authored andcommitted
selftests/futex: Define SYS_futex on 32-bit architectures with 64-bit time_t
The kernel does not provide sys_futex() on 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 <[email protected]> Signed-off-by: Ben Zong-You Xie <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Muhammad Usama Anjum <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 7497e94 commit 0485081

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tools/testing/selftests/futex/include/futextest.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ typedef volatile u_int32_t futex_t;
4747
FUTEX_PRIVATE_FLAG)
4848
#endif
4949

50+
/*
51+
* SYS_futex is expected from system C library, in glibc some 32-bit
52+
* architectures (e.g. RV32) are using 64-bit time_t, therefore it doesn't have
53+
* SYS_futex defined but just SYS_futex_time64. Define SYS_futex as
54+
* SYS_futex_time64 in this situation to ensure the compilation and the
55+
* compatibility.
56+
*/
57+
#if !defined(SYS_futex) && defined(SYS_futex_time64)
58+
#define SYS_futex SYS_futex_time64
59+
#endif
60+
5061
/**
5162
* futex() - SYS_futex syscall wrapper
5263
* @uaddr: address of first futex

0 commit comments

Comments
 (0)