1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

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

This doesn't need to be its own syscall. Thanks @BenWiederhake for
the idea. :^)
This commit is contained in:
Andreas Kling 2020-08-30 10:43:15 +02:00
parent 95ed363b15
commit f857f3ce4c
5 changed files with 4 additions and 22 deletions

View file

@ -42,6 +42,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
extern "C" {
@ -336,7 +337,8 @@ int sleep(unsigned seconds)
int usleep(useconds_t usec)
{
return syscall(SC_usleep, usec);
struct timespec ts = { (long)(usec / 1000000), (long)(usec % 1000000) * 1000 };
return clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, nullptr);
}
int gethostname(char* buffer, size_t size)