From 81ed334f67e0c56ff0a89ade0fc156c0ba23f190 Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Sun, 25 Feb 2024 14:43:28 +0300 Subject: Add support for using time64 on big-endian machines. For BE architectures there is one significant difference in comparison with time64 support for little-endian architectures like ARMv7. The difference is that we strictly need to pass two 64bit values to system calls because Linux Kernel internally uses `struct __kernel_timespec` and similar, which consists of two 64bit fields. For this reason many files have been changed to convert pointers to timespec-family structures (mixed of 64bit and 32bit values) to the pointer of the similar but 64bit-only structures for using as system calls args. This is general prerequisite for any BE architecture. Signed-off-by: Dmitry Chestnykh --- librt/clock_nanosleep.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'librt/clock_nanosleep.c') diff --git a/librt/clock_nanosleep.c b/librt/clock_nanosleep.c index eaae75720..ef59369df 100644 --- a/librt/clock_nanosleep.c +++ b/librt/clock_nanosleep.c @@ -21,6 +21,9 @@ #include "kernel-posix-cpu-timers.h" +#if defined(__UCLIBC_USE_TIME64__) +#include "internal/time64_helpers.h" +#endif /* We can simply use the syscall. The CPU clocks are not supported with this function. */ @@ -38,7 +41,7 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, if (SINGLE_THREAD_P) #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_nanosleep_time64) - r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, req, rem); + r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, TO_TS64_P(req), rem); #else r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem); #endif @@ -47,7 +50,7 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, #ifdef __NEW_THREADS int oldstate = LIBC_CANCEL_ASYNC (); #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_nanosleep_time64) - r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, req, rem); + r = INTERNAL_SYSCALL (clock_nanosleep_time64, err, 4, clock_id, flags, TO_TS64_P(req), rem); #else r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem); -- cgit v1.2.3