[PATCH v2 4/5] linux: remove time64 redirects for __TIMESIZE=64 architectures
Arnd Bergmann
arnd@kernel.org
Mon Nov 16 12:08:56 GMT 2026
From: Arnd Bergmann <arnd@arndb.de>
The arc, loongarch32, or1k and riscv32 redirect the time32 syscall macros
(__NR_futex etc) to the time64 versions. All four require Linux 5.1 or
later, so __ASSUME_TIME64_SYSCALLS is always set and the generic code
now uses the time64 names explicitly. Remove the redirects.
Also remove the '#ifdef __NR_futex' guards from the PI mutex code, which
would otherwise silently compile out PI support on these architectures.
Every Linux ABI provides either futex or futex_time64.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
nptl/pthread_mutex_lock.c | 5 -----
nptl/pthread_mutex_timedlock.c | 5 -----
nptl/pthread_mutex_trylock.c | 5 -----
nptl/pthread_mutex_unlock.c | 5 -----
sysdeps/unix/sysv/linux/arc/sysdep.h | 19 ------------------
sysdeps/unix/sysv/linux/loongarch/sysdep.h | 12 -----------
sysdeps/unix/sysv/linux/or1k/sysdep.h | 20 ++-----------------
sysdeps/unix/sysv/linux/riscv/sysdep.h | 23 ----------------------
8 files changed, 2 insertions(+), 92 deletions(-)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index e93bd8831472..6551a9998361 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -342,10 +342,6 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
- /* The PI support requires the Linux futex system call. If that's not
- available, pthread_mutex_init should never have allowed the type to
- be set. So it will get the default case for an invalid type. */
-#ifdef __NR_futex
case PTHREAD_MUTEX_PI_RECURSIVE_NP:
case PTHREAD_MUTEX_PI_ERRORCHECK_NP:
case PTHREAD_MUTEX_PI_NORMAL_NP:
@@ -506,7 +502,6 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
}
}
break;
-#endif /* __NR_futex. */
case PTHREAD_MUTEX_PP_RECURSIVE_NP:
case PTHREAD_MUTEX_PP_ERRORCHECK_NP:
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 03c21d4c51c4..821a2ed55f4e 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -277,10 +277,6 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
- /* The PI support requires the Linux futex system call. If that's not
- available, pthread_mutex_init should never have allowed the type to
- be set. So it will get the default case for an invalid type. */
-#ifdef __NR_futex
case PTHREAD_MUTEX_PI_RECURSIVE_NP:
case PTHREAD_MUTEX_PI_ERRORCHECK_NP:
case PTHREAD_MUTEX_PI_NORMAL_NP:
@@ -430,7 +426,6 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex,
}
}
break;
-#endif /* __NR_futex. */
case PTHREAD_MUTEX_PP_RECURSIVE_NP:
case PTHREAD_MUTEX_PP_ERRORCHECK_NP:
diff --git a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
index d9beb06e73d5..5cfb37ae615d 100644
--- a/nptl/pthread_mutex_trylock.c
+++ b/nptl/pthread_mutex_trylock.c
@@ -199,10 +199,6 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
return 0;
- /* The PI support requires the Linux futex system call. If that's not
- available, pthread_mutex_init should never have allowed the type to
- be set. So it will get the default case for an invalid type. */
-#ifdef __NR_futex
case PTHREAD_MUTEX_PI_RECURSIVE_NP:
case PTHREAD_MUTEX_PI_ERRORCHECK_NP:
case PTHREAD_MUTEX_PI_NORMAL_NP:
@@ -359,7 +355,6 @@ ___pthread_mutex_trylock (pthread_mutex_t *mutex)
return 0;
}
-#endif /* __NR_futex. */
case PTHREAD_MUTEX_PP_RECURSIVE_NP:
case PTHREAD_MUTEX_PP_ERRORCHECK_NP:
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index fc1c9512754a..990ddaff5864 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -176,10 +176,6 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
- /* The PI support requires the Linux futex system call. If that's not
- available, pthread_mutex_init should never have allowed the type to
- be set. So it will get the default case for an invalid type. */
-#ifdef __NR_futex
case PTHREAD_MUTEX_PI_RECURSIVE_NP:
/* Recursive mutex. */
if (mutex->__data.__owner != THREAD_GETMEM (THREAD_SELF, tid))
@@ -292,7 +288,6 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
PTHREAD_MUTEX_ROBUST_NORMAL_NP. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
break;
-#endif /* __NR_futex. */
case PTHREAD_MUTEX_PP_RECURSIVE_NP:
/* Recursive mutex. */
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index 90cea3f840f1..0b22bd5f08a3 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -24,25 +24,6 @@
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
-/* "workarounds" for generic code needing to handle 64-bit time_t. */
-
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */
-#define __NR_clock_getres __NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h. */
-#define __NR_futex __NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c. */
-#define __NR_ppoll __NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c. */
-#define __NR_pselect6 __NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */
-#define __NR_recvmmsg __NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */
-#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */
-#define __NR_semtimedop __NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */
-#define __NR_utimensat __NR_utimensat_time64
-
/* For RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
index eaa9e52575b1..0f23b33b0b75 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
@@ -116,18 +116,6 @@
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
-#if __WORDSIZE == 32
-/* Workarounds for generic code needing to handle 64-bit time_t. */
-#define __NR_clock_getres __NR_clock_getres_time64
-#define __NR_futex __NR_futex_time64
-#define __NR_ppoll __NR_ppoll_time64
-#define __NR_pselect6 __NR_pselect6_time64
-#define __NR_recvmmsg __NR_recvmmsg_time64
-#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
-#define __NR_semtimedop __NR_semtimedop_time64
-#define __NR_utimensat __NR_utimensat_time64
-#endif /* __WORDSIZE == 32 */
-
#ifndef __ASSEMBLER__
#define VDSO_NAME "LINUX_5.10"
diff --git a/sysdeps/unix/sysv/linux/or1k/sysdep.h b/sysdeps/unix/sysv/linux/or1k/sysdep.h
index e08a66161a04..b1e59386367c 100644
--- a/sysdeps/unix/sysv/linux/or1k/sysdep.h
+++ b/sysdeps/unix/sysv/linux/or1k/sysdep.h
@@ -24,7 +24,8 @@
#include <sysdeps/unix/sysdep.h>
#include <tls.h>
-/* "workarounds" for generic code needing to handle 64-bit time_t. */
+/* or1k always uses 64-bit time_t, so hide the time32 system call numbers
+ from generic code and only use the time64 variants. */
#undef __NR_clock_getres
#undef __NR_futex
@@ -35,23 +36,6 @@
#undef __NR_semtimedop
#undef __NR_utimensat
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */
-#define __NR_clock_getres __NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h. */
-#define __NR_futex __NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c. */
-#define __NR_ppoll __NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c. */
-#define __NR_pselect6 __NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */
-#define __NR_recvmmsg __NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */
-#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */
-#define __NR_semtimedop __NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */
-#define __NR_utimensat __NR_utimensat_time64
-
#undef SYS_ify
#define SYS_ify(syscall_name) (__NR_##syscall_name)
diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index 7f0eb070455a..227238cbac14 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -26,29 +26,6 @@
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
-#if __WORDSIZE == 32
-
-/* Workarounds for generic code needing to handle 64-bit time_t. */
-
-/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */
-#define __NR_clock_getres __NR_clock_getres_time64
-/* Fix sysdeps/nptl/lowlevellock-futex.h. */
-#define __NR_futex __NR_futex_time64
-/* Fix sysdeps/unix/sysv/linux/pause.c. */
-#define __NR_ppoll __NR_ppoll_time64
-/* Fix sysdeps/unix/sysv/linux/select.c. */
-#define __NR_pselect6 __NR_pselect6_time64
-/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */
-#define __NR_recvmmsg __NR_recvmmsg_time64
-/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */
-#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
-/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */
-#define __NR_semtimedop __NR_semtimedop_time64
-/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */
-#define __NR_utimensat __NR_utimensat_time64
-
-#endif /* __WORDSIZE == 32 */
-
#ifdef __ASSEMBLER__
# include <sys/asm.h>
--
2.53.0
More information about the Libc-alpha
mailing list