aboutsummaryrefslogtreecommitdiff
path: root/nptl/sem_timedwait.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-09-08 00:42:10 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-10-24 12:53:27 +0200
commitedd2c042edae009e62ddf33b76f65a9a4d2ceede (patch)
treef8bf313f2349fef5c5ec4e821c8383e1e643fb23 /nptl/sem_timedwait.c
parentab06a727ab8176482c472a2956f7458a308b29a8 (diff)
downloadglibc-edd2c042edae009e62ddf33b76f65a9a4d2ceede.tar
glibc-edd2c042edae009e62ddf33b76f65a9a4d2ceede.tar.gz
glibc-edd2c042edae009e62ddf33b76f65a9a4d2ceede.tar.bz2
glibc-edd2c042edae009e62ddf33b76f65a9a4d2ceede.zip
Y2038: add functions using futexes
This creates 64-bit time versions of the following APIs: - pthread_rwlock_timedrdlock - pthread_rwlock_timedwrlock - pthread_mutex_timedlock - pthread_cond_timedwait - sem_timedwait - aio_suspend It also creates 64-bit time versions of the following functions or macros: - lll_timedlock_elision - lll_timedlock - __lll_timedlock_wait - futex_reltimed_wait_cancelable - lll_futex_timed_wait - __pthread_cond_wait_common - futex_abstimed_wait_cancelable - lll_futex_timed_wait_bitset - do_aio_misc_wait - AIO_MISC_WAIT - __new_sem_wait_slow - do_futex_wait - __pthread_rwlock_wrlock_full - __pthread_rwlock_rdlock_full - futex_abstimed_wait
Diffstat (limited to 'nptl/sem_timedwait.c')
-rw-r--r--nptl/sem_timedwait.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/nptl/sem_timedwait.c b/nptl/sem_timedwait.c
index 8886ea2fb3..8a6bfba4ec 100644
--- a/nptl/sem_timedwait.c
+++ b/nptl/sem_timedwait.c
@@ -38,3 +38,21 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
else
return __new_sem_wait_slow((struct new_sem *) sem, abstime);
}
+
+int
+__sem_timedwait64 (sem_t *sem, const struct __timespec64 *abstime)
+{
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* Check sem_wait.c for a more detailed explanation why it is required. */
+ __pthread_testcancel ();
+
+ if (__new_sem_wait_fast ((struct new_sem *) sem, 0) == 0)
+ return 0;
+ else
+ return __new_sem_wait_slow64 ((struct new_sem *) sem, abstime);
+}