mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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: https://github.com/SerenityOS/serenity/commit/4484513b45c 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;
|
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)
|
int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* user_params)
|
||||||
{
|
{
|
||||||
REQUIRE_PROMISE(stdio);
|
REQUIRE_PROMISE(stdio);
|
||||||
|
|
|
@ -213,6 +213,7 @@ public:
|
||||||
int sys$usleep(useconds_t usec);
|
int sys$usleep(useconds_t usec);
|
||||||
int sys$gettimeofday(timeval*);
|
int sys$gettimeofday(timeval*);
|
||||||
int sys$clock_gettime(clockid_t, timespec*);
|
int sys$clock_gettime(clockid_t, timespec*);
|
||||||
|
int sys$clock_settime(clockid_t, timespec*);
|
||||||
int sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params*);
|
int sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params*);
|
||||||
int sys$gethostname(char*, ssize_t);
|
int sys$gethostname(char*, ssize_t);
|
||||||
int sys$uname(utsname*);
|
int sys$uname(utsname*);
|
||||||
|
|
|
@ -158,6 +158,7 @@ namespace Kernel {
|
||||||
__ENUMERATE_SYSCALL(getrandom) \
|
__ENUMERATE_SYSCALL(getrandom) \
|
||||||
__ENUMERATE_SYSCALL(setkeymap) \
|
__ENUMERATE_SYSCALL(setkeymap) \
|
||||||
__ENUMERATE_SYSCALL(clock_gettime) \
|
__ENUMERATE_SYSCALL(clock_gettime) \
|
||||||
|
__ENUMERATE_SYSCALL(clock_settime) \
|
||||||
__ENUMERATE_SYSCALL(clock_nanosleep) \
|
__ENUMERATE_SYSCALL(clock_nanosleep) \
|
||||||
__ENUMERATE_SYSCALL(join_thread) \
|
__ENUMERATE_SYSCALL(join_thread) \
|
||||||
__ENUMERATE_SYSCALL(module_load) \
|
__ENUMERATE_SYSCALL(module_load) \
|
||||||
|
|
Loading…
Reference in a new issue