Commit 04850819 authored by Cynthia Huang's avatar Cynthia Huang Committed by Thomas Gleixner
Browse files

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: default avatarCynthia Huang <cynthia@andestech.com>
Signed-off-by: default avatarBen Zong-You Xie <ben717@andestech.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/all/20250710103630.3156130-1-ben717@andestech.com
parent 7497e947
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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