From 4a14cb87cad30bb15bb906e579089109874f3071 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 20 Jul 2020 15:50:12 +0200 Subject: y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time The pthread_clockjoin_np and pthread_timedjoin_np have been converted to support 64 bit time. This change introduces new futex_timed_wait_cancel64 function in ./sysdeps/nptl/futex-internal.h, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_{timed|clock}join_np only accept absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as clockwait_tid() always passes struct __timespec64. For systems with __TIMESIZE != 64 && __WORDSIZE == 32: - Conversions between 64 bit time to 32 bit are necessary - Redirection to __pthread_{clock|timed}join_np64 will provide support for 64 bit time 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_{timed|clock}join_np64 and __pthread_{timed|clock}join_np. Reviewed-by: Adhemerval Zanella Reviewed-by: Alistair Francis --- nptl/pthreadP.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'nptl/pthreadP.h') diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 6f94d6be31..99713c8447 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -458,6 +458,20 @@ extern int __pthread_cond_init (pthread_cond_t *cond, libc_hidden_proto (__pthread_cond_init) extern int __pthread_cond_signal (pthread_cond_t *cond); extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); + +#if __TIMESIZE == 64 +# define __pthread_clockjoin_np64 __pthread_clockjoin_np +# define __pthread_timedjoin_np64 __pthread_timedjoin_np +#else +extern int __pthread_clockjoin_np64 (pthread_t threadid, void **thread_return, + clockid_t clockid, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_clockjoin_np64) +extern int __pthread_timedjoin_np64 (pthread_t threadid, void **thread_return, + const struct __timespec64 *abstime); +libc_hidden_proto (__pthread_timedjoin_np64) +#endif + extern int __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); @@ -488,7 +502,7 @@ extern int __pthread_enable_asynccancel (void) attribute_hidden; extern void __pthread_disable_asynccancel (int oldtype) attribute_hidden; extern void __pthread_testcancel (void); extern int __pthread_clockjoin_ex (pthread_t, void **, clockid_t, - const struct timespec *, bool) + const struct __timespec64 *, bool) attribute_hidden; extern int __pthread_sigmask (int, const sigset_t *, sigset_t *); libc_hidden_proto (__pthread_sigmask); -- cgit 1.4.1