On Wed, Aug 12, 2020 at 3:22 AM Lukasz Majewski wrote: > > 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. > > --- > Changes for v2: > - Update the commit message > > Changes for v3: > - Use const qualifier for futex_timed_wait_cancel64() timeout parameter > - Use INTERNAL_SYSCALL_CALL macro instead of INTERNAL_SYSCALL > - Use LIBC_CANCEL_{RESET|ASYNC} macro instead of CANCEL_{RESET|ASYNC} > - Add switch clause with listing possible error values returned by > futex{_time64} syscall > > Changes for v4: > > - Update comment when -EOVERFLOW is returned from futex syscall > - Use INTERNAL_SYSCALL_CANCELL instead of INTERNAL_SYSCALL_CALL > (with or without LIBC_CANCEL_ASYNC/LIBC_CANCEL_RESET) to make > the code smaller as it hides cancellation points handling. > > Changes for v5: > > - Refactor the code to avoid using goto > diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c > index a3e7f37e3b..3cd780f688 100644 > --- a/nptl/pthread_clockjoin.c > +++ b/nptl/pthread_clockjoin.c > @@ -16,14 +16,27 @@ > License along with the GNU C Library; if not, see > . */ > > +#include > #include "pthreadP.h" > > int > -__pthread_clockjoin_np (pthread_t threadid, void **thread_return, > - clockid_t clockid, > - const struct timespec *abstime) > +__pthread_clockjoin_np64 (pthread_t threadid, void **thread_return, > + clockid_t clockid, const struct __timespec64 *abstime) > { > return __pthread_clockjoin_ex (threadid, thread_return, > clockid, abstime, true); > } > + > +#if __TIMESIZE != 64 > +libc_hidden_def (__pthread_clockjoin_np64) > + > +int > +__pthread_clockjoin_np (pthread_t threadid, void **thread_return, > + clockid_t clockid, const struct timespec *abstime) > +{ > + struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime); > + > + return __pthread_clockjoin_np64 (threadid, thread_return, clockid, &ts64); > +} > +#endif > weak_alias (__pthread_clockjoin_np, pthread_clockjoin_np) > +#if __TIMESIZE != 64 > +libc_hidden_def (__pthread_timedjoin_np64) > + > +int > +__pthread_timedjoin_np (pthread_t threadid, void **thread_return, > + const struct timespec *abstime) > +{ > + struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime); > + > + return __pthread_timedjoin_np64 (threadid, thread_return, &ts64); > +} > +#endif > weak_alias (__pthread_timedjoin_np, pthread_timedjoin_np) This caused: https://sourceware.org/bugzilla/show_bug.cgi?id=26394 I am testing this. -- H.J.