summaryrefslogtreecommitdiff
path: root/Libraries/LibC
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-30 13:21:24 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-30 13:21:24 +0200
commit57dd3b66c5db7fc57d4e1c55f1515901e02bf419 (patch)
treecdea89b75a00d6f8d63d6e10348ea846fec844bf /Libraries/LibC
parentcc5403f77bba64f8195a341e35a652e221e477e0 (diff)
downloadserenity-57dd3b66c5db7fc57d4e1c55f1515901e02bf419.zip
Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall either. :^)
Diffstat (limited to 'Libraries/LibC')
-rw-r--r--Libraries/LibC/unistd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp
index c7aee64815..04a0fd3289 100644
--- a/Libraries/LibC/unistd.cpp
+++ b/Libraries/LibC/unistd.cpp
@@ -332,7 +332,10 @@ char* getwd(char* buf)
int sleep(unsigned seconds)
{
- return syscall(SC_sleep, seconds);
+ struct timespec ts = { seconds, 0 };
+ if (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts) < 0)
+ return ts.tv_sec;
+ return 0;
}
int usleep(useconds_t usec)