[RFC,v1,02/16] sysdeps/futex: Use __NR_futex_time64 if we don't have __NR_futex
Commit Message
__NR_futex isn't avaliable on newer 32-bit architectures (such as RV32)
so if it isn't avaliable lets use __NR_futex_time64 instead.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
ChangeLog | 1 +
sysdeps/unix/sysv/linux/lowlevellock-futex.h | 28 ++++++++++++++------
2 files changed, 21 insertions(+), 8 deletions(-)
@@ -3,6 +3,7 @@
* nptl/thrd_sleep.c: Use clock_nanosleep_time64 instead of nanosleep.
* sysdeps/unix/sysv/linux/nanosleep.c: Likewise.
* sysdeps/unix/sysv/linux/nanosleep_nocancel.c: Likewise.
+ * sysdeps/unix/sysv/linux/lowlevellock-futex.h: Use __NR_futex_time64 if we don't have __NR_futex.
2019-06-20 Dmitry V. Levin <ldv@altlinux.org>
Florian Weimer <fweimer@redhat.com>
@@ -65,14 +65,26 @@
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
#endif
-#define lll_futex_syscall(nargs, futexp, op, ...) \
- ({ \
- INTERNAL_SYSCALL_DECL (__err); \
- long int __ret = INTERNAL_SYSCALL (futex, __err, nargs, futexp, op, \
- __VA_ARGS__); \
- (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \
- ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0); \
- })
+#ifndef __NR_futex
+/* __NR_futex isn't defined on all archs (RV32) so use __NR_futex_time64 */
+# define lll_futex_syscall(nargs, futexp, op, ...) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret = INTERNAL_SYSCALL (futex_time64, __err, nargs, futexp, op, \
+ __VA_ARGS__); \
+ (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \
+ ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0); \
+ })
+#else
+# define lll_futex_syscall(nargs, futexp, op, ...) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret = INTERNAL_SYSCALL (futex, __err, nargs, futexp, op, \
+ __VA_ARGS__); \
+ (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret, __err)) \
+ ? -INTERNAL_SYSCALL_ERRNO (__ret, __err) : 0); \
+ })
+#endif
#define lll_futex_wait(futexp, val, private) \
lll_futex_timed_wait (futexp, val, NULL, private)