mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 02:48:11 +00:00
Kernel: Remove SmapDisabler in sys$clock_gettime()
This commit is contained in:
parent
7533d61458
commit
7717084ac7
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;
|
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);
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_write_typed(ts))
|
if (!validate_write_typed(user_ts))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
SmapDisabler disabler;
|
timespec ts;
|
||||||
|
memset(&ts, 0, sizeof(ts));
|
||||||
|
|
||||||
switch (clock_id) {
|
switch (clock_id) {
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
ts->tv_sec = g_uptime / TICKS_PER_SECOND;
|
ts.tv_sec = g_uptime / TICKS_PER_SECOND;
|
||||||
ts->tv_nsec = (g_uptime % TICKS_PER_SECOND) * 1000000;
|
ts.tv_nsec = (g_uptime % TICKS_PER_SECOND) * 1000000;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy_to_user(user_ts, &ts);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue