19 lines
403 B
C++
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;
|
|
}
|