summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-16 08:13:11 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-16 08:13:11 +0100
commit7717084ac783d97e241bcd23ccd61f7abaa43a96 (patch)
treec3f1feb1b0078ab25f681705f8d857882f86321d /Kernel/Process.cpp
parent7533d6145887aaefe5540672efd299afca9cca31 (diff)
downloadserenity-7717084ac783d97e241bcd23ccd61f7abaa43a96.zip
Kernel: Remove SmapDisabler in sys$clock_gettime()
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index ca17fa8a19..eb26c97327 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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;
}