Luna/kernel/src/sys/alarm.cpp
apio e2a77bb3da
Some checks failed
continuous-integration/drone/push Build is failing
kernel+libc: Add pledge support
2023-08-12 21:38:25 +02:00

19 lines
403 B
C++

#include "Pledge.h"
#include "sys/Syscall.h"
#include "thread/Scheduler.h"
Result<u64> sys_alarm(Registers*, SyscallArgs args)
{
unsigned int seconds = (unsigned int)args[0];
auto* current = Scheduler::current();
TRY(check_pledge(current, Promise::p_stdio));
u64 time_left = current->alarm_ticks_left;
current->alarm_ticks_left = seconds * 1000;
return time_left * 1000;
}