aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/nptl/futex-internal.h
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2020-08-11 10:49:03 +0200
committerLukasz Majewski <lukma@denx.de>2020-09-02 09:49:54 +0200
commit323592fdc92a0021319419f210a6052542856654 (patch)
treec1869089a17566d851f9b3ef1e7f442651a544cb /sysdeps/nptl/futex-internal.h
parent30e5069c7d4b51288d3e6f75f53a6ad2f5e71b0f (diff)
downloadglibc-323592fdc92a0021319419f210a6052542856654.tar
glibc-323592fdc92a0021319419f210a6052542856654.tar.gz
glibc-323592fdc92a0021319419f210a6052542856654.tar.bz2
glibc-323592fdc92a0021319419f210a6052542856654.zip
y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time
The pthread_cond_clockwait and pthread_cond_timedwait have been converted to support 64 bit time. This change introduces new futex_abstimed_wait_cancelable64 function in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_cond_{clock|timed}wait only accepts absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as __pthread_cond_wait_common() always passes non-NULL struct __timespec64 pointer to futex_abstimed_wait_cancellable64(). For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to __pthread_cond_{clock|timed}wait64 will provide support for 64 bit time The futex_abstimed_wait_cancelable64 function has been put into a separate file on the purpose - to avoid issues apparent on the m68k architecture related to small number of available registers (there is not enough registers to put all necessary arguments in them if the above function would be added to futex-internal.h with __always_inline attribute). In fact - new function - namely __futex_abstimed_wait_cancellable32 is used to reduce number of needed registers (as some in-register values are stored on the stack when function call is made). Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test the proper usage of both __pthread_cond_{clock|timed}wait64 and __pthread_cond_{clock|timed}wait. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl/futex-internal.h')
-rw-r--r--sysdeps/nptl/futex-internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index 159aae82dc..84ab3f3853 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -519,4 +519,14 @@ futex_timed_wait_cancel64 (pid_t *tidp, pid_t tid,
futex_fatal_error ();
}
}
+
+/* The futex_abstimed_wait_cancelable64 has been moved to a separate file
+ to avoid problems with exhausting available registers on some architectures
+ - e.g. on m68k architecture. */
+int
+__futex_abstimed_wait_cancelable64 (unsigned int* futex_word,
+ unsigned int expected, clockid_t clockid,
+ const struct __timespec64* abstime,
+ int private) attribute_hidden;
+
#endif /* futex-internal.h */