1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

Kernel: Add new syscall to allow changing the system date

This commit is contained in:
Liav A 2020-03-13 01:17:14 +02:00 committed by Andreas Kling
parent 4fcc10c6c3
commit 4484513b45
3 changed files with 19 additions and 0 deletions

View file

@ -4283,6 +4283,23 @@ int Process::sys$clock_gettime(clockid_t clock_id, timespec* user_ts)
return 0;
}
int Process::sys$clock_settime(clockid_t clock_id, timespec* user_ts)
{
SmapDisabler disabler;
REQUIRE_PROMISE(stdio);
if (!validate_write_typed(user_ts))
return -EFAULT;
switch (clock_id) {
case CLOCK_REALTIME:
TimeManagement::the().set_epoch_time(user_ts->tv_sec);
break;
default:
return -EINVAL;
}
return 0;
}
int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* user_params)
{
REQUIRE_PROMISE(stdio);