summaryrefslogtreecommitdiff
path: root/librt/clock_nanosleep.c
diff options
context:
space:
mode:
authorDmitry Chestnykh <dm.chestnykh@gmail.com>2024-02-25 14:43:28 +0300
committerWaldemar Brodkorb <wbx@openadk.org>2024-02-25 19:27:48 +0100
commit81ed334f67e0c56ff0a89ade0fc156c0ba23f190 (patch)
tree09829cc5cd0d03a4f91887864f6a3c28213549af /librt/clock_nanosleep.c
parent086a5f165096af104b01bb6d5639bd769bd17620 (diff)
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 <dm.chestnykh@gmail.com>
Diffstat (limited to 'librt/clock_nanosleep.c')
-rw-r--r--librt/clock_nanosleep.c7
1 files changed, 5 insertions, 2 deletions
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);