about summary refs log tree commit diff
path: root/sysdeps/nptl/aio_misc.h
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2020-11-23 17:47:20 -0300
committerLukasz Majewski <lukma@denx.de>2020-11-30 14:08:44 +0100
commitcc5d5852c65eddf92368b0845e1374bd443316e7 (patch)
tree5ee539d880f98c0d74e2d6b8fa342aaafe88e758 /sysdeps/nptl/aio_misc.h
parentfdb724f9032ff73310be0e51549f494a3eaa7495 (diff)
downloadglibc-cc5d5852c65eddf92368b0845e1374bd443316e7.tar.gz
glibc-cc5d5852c65eddf92368b0845e1374bd443316e7.tar.xz
glibc-cc5d5852c65eddf92368b0845e1374bd443316e7.zip
y2038: Convert aio_suspend to support 64 bit time
The aio_suspend function has been converted to support 64 bit time.

This change uses (in aio_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 aio_suspend() accepts relative timeout, which then is converted to
absolute one.

The i686-gnu port (HURD) do not define DONT_NEED_AIO_MISC_COND and as it
doesn't (yet) support 64 bit time it uses not converted
pthread_cond_timedwait().

The __aio_suspend() is supposed to be run on ports with __TIMESIZE !=64 and
__WORDSIZE==32. It internally utilizes __aio_suspend_time64() and hence the
conversion from 32 bit struct timespec to 64 bit one is required.

For ports supporting 64 bit time the __aio_suspend_time64() will be used
either via alias (to __aio_suspend when __TIMESIZE==64) or redirection
(when -D_TIME_BITS=64 is passed).

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl/aio_misc.h')
-rw-r--r--sysdeps/nptl/aio_misc.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sysdeps/nptl/aio_misc.h b/sysdeps/nptl/aio_misc.h
index 3f195f4794..effe94efaa 100644
--- a/sysdeps/nptl/aio_misc.h
+++ b/sysdeps/nptl/aio_misc.h
@@ -45,11 +45,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;							      \
 									      \
@@ -61,6 +62,8 @@
 	  result = EINTR;						      \
 	else if (status == ETIMEDOUT)					      \
 	  result = EAGAIN;						      \
+	else if (status == EOVERFLOW)					      \
+	  result = EOVERFLOW;						      \
 	else								      \
 	  assert (status == 0 || status == EAGAIN);			      \
 									      \