Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()

This doesn't need to be its own syscall either. :^)
This commit is contained in:
Andreas Kling 2020-08-30 13:21:24 +02:00
commit 57dd3b66c5
Notes: sideshowbarker 2024-07-19 03:00:09 +09:00
6 changed files with 4 additions and 56 deletions

View file

@ -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)