diff options
author | Dmitry Chestnykh <dm.chestnykh@gmail.com> | 2024-02-28 11:45:09 +0300 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-02-28 10:07:11 +0100 |
commit | c6e359dbc7bd155b10e15616d11e15c48b8bbefa (patch) | |
tree | a3a881c1cbeba8db9b7373a3e0b92eb0b0202a02 /libpthread/nptl/sysdeps | |
parent | 8a6af75fcae2d24cd14f2d91c11a52adae154ebc (diff) |
libc: Pass 64bit-only time structures to syscalls.
With time64 enabled we need to pass structure
which consists of two 64bit fields to clock_gettime64()
and clock_nanosleep_time64() syscalls with proper conversion
to regular timespec structure after syscall execution.
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
Diffstat (limited to 'libpthread/nptl/sysdeps')
-rw-r--r-- | libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c index 49aab0293..ce738b1a1 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c +++ b/libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c @@ -95,18 +95,27 @@ __pthread_cond_timedwait ( while (1) { - struct timespec rt; + struct timespec rt = {.tv_sec = 0, .tv_nsec = 0}; +#if defined(__UCLIBC_USE_TIME64__) + struct __ts64_struct __rt64; +#endif { #ifdef __NR_clock_gettime INTERNAL_SYSCALL_DECL (err); -# ifndef __ASSUME_POSIX_TIMERS +# if !defined(__ASSUME_POSIX_TIMERS) || defined(__UCLIBC_USE_TIME64__) int ret = # endif #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_gettime64) INTERNAL_SYSCALL (clock_gettime64, err, 2, (cond->__data.__nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1)), - &rt); + &__rt64); + + if (ret == 0) { + rt.tv_sec = __rt64.tv_sec; + rt.tv_nsec = __rt64.tv_nsec; + } + #else INTERNAL_SYSCALL (clock_gettime, err, 2, (cond->__data.__nwaiters |