mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
Kernel: Add new syscall to allow changing the system date
This commit is contained in:
parent
4fcc10c6c3
commit
4484513b45
Notes:
sideshowbarker
2024-07-19 08:14:22 +09:00
Author: https://github.com/supercomputer7
Commit: 4484513b45
Pull-request: https://github.com/SerenityOS/serenity/pull/1396
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 19 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue