This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC v1 02/16] sysdeps/futex: Use __NR_futex_time64 if we don't have __NR_futex
- From: Alistair Francis <alistair dot francis at wdc dot com>
- To: libc-alpha at sourceware dot org
- Cc: alistair dot francis at wdc dot com, alistair23 at gmail dot com
- Date: Fri, 21 Jun 2019 21:37:17 -0700
- Subject: [RFC v1 02/16] sysdeps/futex: Use __NR_futex_time64 if we don't have __NR_futex
- Ironport-sdr: jVDd2PrnY8KDlAlDHLEkVBJgZwqtnSpHfkwtk4mIFp4gMjjMZo59SksSo61yKp17ACDdJOYvbB L7pwlPnQXTI7KJBK98z45hU5mf7MvKwJ1+b0StRBsGRC/9LJFJZZ/WGy/WLf6UDi66JIjS+K7E EQlj3dcq0u//cmXfvcq0V8b8tkaL9wr7UcM8qYtxBwdGKchzCkBKM22DdYG4X0c2sHWZZXH/cg +yEcF+CANxgbGvGvSGsfkkuJqDtNPl/Q1VP0HJ4BTk2soAeGeYpS+JVirzNNf2uEPneav5d9HR nUcdHa8JMLKRQclVem/HpPLg
- Ironport-sdr: 8m4/NBnlu+sCWjwdyo/LKbRjLpMCpbfvQjsoedQAlKO85+65m95GtNgR89y7YXGCXPWvsptWIC O6aLMoFC/vwJTCM/a+Fnr2/6Gp3uQjQL6lTKsESwDETMXh/NV8U6JnMUnIEIL9PmMos4TvzLLJ +BxC0VrMIvJYxUVW57u8D+ZYmINRV1sdvYNCgh5+pDh0znDWjIQWUDdDa5hIQqPn++pTcJJpVe dmUQCaLertZNa0wkaNcfeZ5iW0RgeGjCxY0SBf8wz6qP33n4+SSKxtKG0B40xbwT4XcvfRIo0D Xv0=
- References: <cover.1561177967.git.alistair.francis@wdc.com>
__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(-)
diff --git a/ChangeLog b/ChangeLog
index b90c5ab60c..a700783ef3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
diff --git a/sysdeps/unix/sysv/linux/lowlevellock-futex.h b/sysdeps/unix/sysv/linux/lowlevellock-futex.h
index 030a14b8dc..cde4a9157c 100644
--- a/sysdeps/unix/sysv/linux/lowlevellock-futex.h
+++ b/sysdeps/unix/sysv/linux/lowlevellock-futex.h
@@ -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)
--
2.22.0