diff options
author | Dmitry Chestnykh <dm.chestnykh@gmail.com> | 2024-02-26 13:21:26 +0300 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-02-26 11:28:42 +0100 |
commit | 73017bba9d3bc0f8ada159319ff590117c9e5689 (patch) | |
tree | 05f6d950a0ef0702f9513085cd9d66cef7d7a1bb /libpthread/nptl/sysdeps/unix | |
parent | fb800e73a9c81a299f55de7a3aba4a0c3ab074e0 (diff) |
Add time64 support for MIPS32.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
Diffstat (limited to 'libpthread/nptl/sysdeps/unix')
-rw-r--r-- | libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h index 450a286b4..9fc000a91 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h @@ -26,6 +26,10 @@ #include <sysdep.h> #include <bits/kernel-features.h> +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif + #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_REQUEUE 3 @@ -77,6 +81,30 @@ #define lll_futex_wait(futexp, val, private) \ lll_futex_timed_wait(futexp, val, NULL, private) +#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64) + +#define lll_futex_timed_wait(futexp, val, timespec, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret attribute_unused; \ + __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (long) (futexp), \ + __lll_private_flag (FUTEX_WAIT, private), \ + (val), (TO_TS64_P(timespec))); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + }) + +#define lll_futex_wake(futexp, nr, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret attribute_unused; \ + __ret = INTERNAL_SYSCALL (futex_time64, __err, 4, (long) (futexp), \ + __lll_private_flag (FUTEX_WAKE, private), \ + (nr), 0); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ + }) + +#else + #define lll_futex_timed_wait(futexp, val, timespec, private) \ ({ \ INTERNAL_SYSCALL_DECL (__err); \ @@ -97,6 +125,8 @@ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \ }) +#endif + #define lll_robust_dead(futexv, private) \ do \ { \ @@ -106,6 +136,35 @@ } \ while (0) +#if defined(__UCLIBC_USE_TIME64__) && defined(__NR_futex_time64) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret attribute_unused; \ + __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (long) (futexp), \ + __lll_private_flag (FUTEX_CMP_REQUEUE, private),\ + (nr_wake), (nr_move), (mutex), (val)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret attribute_unused; \ + \ + __ret = INTERNAL_SYSCALL (futex_time64, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_WAKE_OP, private), \ + (nr_wake), (nr_wake2), (futexp2), \ + FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + + +#else + /* Returns non-zero if error happened, zero if success. */ #define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \ ({ \ @@ -130,6 +189,8 @@ INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ }) +#endif + static inline int __attribute__((always_inline)) __lll_trylock(int *futex) { |