diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-30 13:21:24 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-30 13:21:24 +0200 |
commit | 57dd3b66c5db7fc57d4e1c55f1515901e02bf419 (patch) | |
tree | cdea89b75a00d6f8d63d6e10348ea846fec844bf /Libraries/LibC | |
parent | cc5403f77bba64f8195a341e35a652e221e477e0 (diff) | |
download | serenity-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.cpp | 5 |
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) |