2023-01-22 14:00:20 +00:00
|
|
|
#include "sys/Syscall.h"
|
|
|
|
#include "thread/Scheduler.h"
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
Result<u64> sys_usleep(Registers*, SyscallArgs args)
|
|
|
|
{
|
|
|
|
useconds_t us = (useconds_t)args[0];
|
|
|
|
|
2023-06-08 17:57:38 +00:00
|
|
|
// FIXME: Allow usleep() to use a more precise resolution.
|
|
|
|
if (us < 1000) return 0;
|
|
|
|
|
2023-01-22 14:00:20 +00:00
|
|
|
kernel_sleep(us / 1000);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|