From 47f78f36836f480b2b7a2041480be966b3a698e3 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 30 Nov 2020 14:33:12 +0100 Subject: y2038: Convert gai_suspend to support 64 bit time This change uses (in gai_misc.h): - __futex_abstimed_wait64 (instead of futex_reltimed_wait) - __futex_abstimed_wait_cancellable64 (instead of futex_reltimed_wait_cancellable) from ./sysdeps/nptl/futex-helpers.h The gai_suspend() accepts relative timeout, which then is converted to absolute one. The i686-gnu port (HURD) do not define DONT_NEED_GAI_MISC_COND and as it doesn't (yet) support 64 bit time it uses not converted pthread_cond_timedwait(). The __gai_suspend() is supposed to be run on ports with __TIMESIZE !=64 and __WORDSIZE==32. It internally utilizes __gai_suspend_time64() and hence the conversion from 32 bit struct timespec to 64 bit one is required. For ports supporting 64 bit time the __gai_suspend_time64() will be used either via alias (to __gai_suspend when __TIMESIZE==64) or redirection (when -D_TIME_BITS=64 is passed). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Adhemerval Zanella Reviewed-by: Alistair Francis --- sysdeps/nptl/gai_misc.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sysdeps/nptl') diff --git a/sysdeps/nptl/gai_misc.h b/sysdeps/nptl/gai_misc.h index c1d5e2e6f0..c72a863974 100644 --- a/sysdeps/nptl/gai_misc.h +++ b/sysdeps/nptl/gai_misc.h @@ -46,11 +46,12 @@ do \ { \ if (cancel) \ - status = futex_reltimed_wait_cancelable ( \ - (unsigned int *) futexaddr, oldval, timeout, FUTEX_PRIVATE); \ + status = __futex_abstimed_wait_cancelable64 ( \ + (unsigned int *) futexaddr, oldval, CLOCK_MONOTONIC, timeout, \ + FUTEX_PRIVATE); \ else \ - status = futex_reltimed_wait ((unsigned int *) futexaddr, \ - oldval, timeout, FUTEX_PRIVATE); \ + status = __futex_abstimed_wait64 ((unsigned int *) futexaddr, \ + oldval, CLOCK_REALTIME, timeout, FUTEX_PRIVATE); \ if (status != EAGAIN) \ break; \ \ @@ -62,6 +63,8 @@ result = EINTR; \ else if (status == ETIMEDOUT) \ result = EAGAIN; \ + else if (status == EOVERFLOW) \ + result = EOVERFLOW; \ else \ assert (status == 0 || status == EAGAIN); \ \ -- cgit 1.4.1