From 3537ecb49cf7177274607004c562d6f9ecc99474 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 5 Nov 2019 21:37:44 +0000 Subject: Refactor nanosleep in terms of clock_nanosleep The generic version is straightforward. For Hurd, its nanosleep implementation is moved to clock_nanosleep with adjustments from generic unix implementation. The generic clock_nanosleep unix version is also removed since it calls nanosleep. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Florian Weimer --- posix/nanosleep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'posix/nanosleep.c') diff --git a/posix/nanosleep.c b/posix/nanosleep.c index d8564c7..ed41c8c 100644 --- a/posix/nanosleep.c +++ b/posix/nanosleep.c @@ -24,10 +24,13 @@ int __nanosleep (const struct timespec *requested_time, struct timespec *remaining) { - __set_errno (ENOSYS); - return -1; + int ret = __clock_nanosleep (CLOCK_REALTIME, 0, requested_time, remaining); + if (ret != 0) + { + __set_errno (ret); + return -1; + } + return 0; } -stub_warning (nanosleep) - -hidden_def (__nanosleep) +libc_hidden_def (__nanosleep) weak_alias (__nanosleep, nanosleep) -- cgit v1.1