From 331993e3fc3623f111d95796d3d7f30b4f6552c1 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 21 Jul 2019 01:53:14 -0400 Subject: refactor thrd_sleep and nanosleep in terms of clock_nanosleep for namespace-safety with thrd_sleep, this requires an alias, which is also added. this eliminates all but one direct call point for nanosleep syscalls, and arranges that 64-bit time_t conversion logic will only need to exist in one file rather than three. as a bonus, clock_nanosleep with CLOCK_REALTIME and empty flags is now implemented as SYS_nanosleep, thereby working on older kernels that may lack POSIX clocks functionality. --- src/thread/thrd_sleep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/thread/thrd_sleep.c') diff --git a/src/thread/thrd_sleep.c b/src/thread/thrd_sleep.c index e8dfe400..97de5345 100644 --- a/src/thread/thrd_sleep.c +++ b/src/thread/thrd_sleep.c @@ -1,10 +1,11 @@ #include +#include #include #include "syscall.h" int thrd_sleep(const struct timespec *req, struct timespec *rem) { - int ret = __syscall(SYS_nanosleep, req, rem); + int ret = -__clock_nanosleep(CLOCK_REALTIME, 0, req, rem); switch (ret) { case 0: return 0; case -EINTR: return -1; /* value specified by C11 */ -- cgit v1.2.1