summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/clock.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-08-04 22:24:45 -0700
committerAndreas Kling <kling@serenityos.org>2020-08-05 09:36:53 +0200
commit84035e103503280cfed51d14b5bc29e9e46d7e3d (patch)
tree550b275ca59d52c294fb31335630f3dd2e0ac8cd /Kernel/Syscalls/clock.cpp
parentbaa070afb891d790c587fe7ae7516789b1655bb7 (diff)
downloadserenity-84035e103503280cfed51d14b5bc29e9e46d7e3d.zip
Kernel: Use Userspace<T> for the clock_nanosleep syscall
Diffstat (limited to 'Kernel/Syscalls/clock.cpp')
-rw-r--r--Kernel/Syscalls/clock.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/Syscalls/clock.cpp b/Kernel/Syscalls/clock.cpp
index 7fc1be5f8a..dc9a6e4c6e 100644
--- a/Kernel/Syscalls/clock.cpp
+++ b/Kernel/Syscalls/clock.cpp
@@ -76,7 +76,7 @@ int Process::sys$clock_settime(clockid_t clock_id, timespec* user_ts)
return 0;
}
-int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* user_params)
+int Process::sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*> user_params)
{
REQUIRE_PROMISE(stdio);
@@ -118,8 +118,7 @@ int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* user_
return -EFAULT;
}
- timespec remaining_sleep;
- memset(&remaining_sleep, 0, sizeof(timespec));
+ timespec remaining_sleep = {};
remaining_sleep.tv_sec = ticks_left / TimeManagement::the().ticks_per_second();
ticks_left -= remaining_sleep.tv_sec * TimeManagement::the().ticks_per_second();
remaining_sleep.tv_nsec = ticks_left * 1000000000 / TimeManagement::the().ticks_per_second();