mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Remove SmapDisabler in sys$clock_gettime()
This commit is contained in:
parent
7533d61458
commit
7717084ac7
Notes:
sideshowbarker
2024-07-19 09:16:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7717084ac78
1 changed files with 8 additions and 5 deletions
|
@ -4183,22 +4183,25 @@ int Process::sys$setkeymap(const Syscall::SC_setkeymap_params* user_params)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$clock_gettime(clockid_t clock_id, timespec* ts)
|
||||
int Process::sys$clock_gettime(clockid_t clock_id, timespec* user_ts)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
if (!validate_write_typed(ts))
|
||||
if (!validate_write_typed(user_ts))
|
||||
return -EFAULT;
|
||||
|
||||
SmapDisabler disabler;
|
||||
timespec ts;
|
||||
memset(&ts, 0, sizeof(ts));
|
||||
|
||||
switch (clock_id) {
|
||||
case CLOCK_MONOTONIC:
|
||||
ts->tv_sec = g_uptime / TICKS_PER_SECOND;
|
||||
ts->tv_nsec = (g_uptime % TICKS_PER_SECOND) * 1000000;
|
||||
ts.tv_sec = g_uptime / TICKS_PER_SECOND;
|
||||
ts.tv_nsec = (g_uptime % TICKS_PER_SECOND) * 1000000;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
copy_to_user(user_ts, &ts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue