summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-08-09 12:42:51 -0700
committerAndreas Kling <kling@serenityos.org>2020-08-10 12:52:15 +0200
commitb4d04fd8d1083e364d638df97941d52cb5c5c481 (patch)
treedb4b8ca632a7bc0921af0e97c94840c0f161880e /Kernel
parent48d9f3c2e6a77f9596a4dbc5d19eb7d5d1976b00 (diff)
downloadserenity-b4d04fd8d1083e364d638df97941d52cb5c5c481.zip
Kernel: Use Userspace<T> for the clock_gettime syscall
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.h2
-rw-r--r--Kernel/Syscalls/clock.cpp5
2 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h
index a363039331..97ba8f8bc4 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -247,7 +247,7 @@ public:
int sys$sleep(unsigned seconds);
int sys$usleep(useconds_t usec);
int sys$gettimeofday(Userspace<timeval*>);
- int sys$clock_gettime(clockid_t, timespec*);
+ int sys$clock_gettime(clockid_t, Userspace<timespec*>);
int sys$clock_settime(clockid_t, timespec*);
int sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*>);
int sys$gethostname(char*, ssize_t);
diff --git a/Kernel/Syscalls/clock.cpp b/Kernel/Syscalls/clock.cpp
index dc9a6e4c6e..3bac104a2c 100644
--- a/Kernel/Syscalls/clock.cpp
+++ b/Kernel/Syscalls/clock.cpp
@@ -29,14 +29,13 @@
namespace Kernel {
-int Process::sys$clock_gettime(clockid_t clock_id, timespec* user_ts)
+int Process::sys$clock_gettime(clockid_t clock_id, Userspace<timespec*> user_ts)
{
REQUIRE_PROMISE(stdio);
if (!validate_write_typed(user_ts))
return -EFAULT;
- timespec ts;
- memset(&ts, 0, sizeof(ts));
+ timespec ts = {};
switch (clock_id) {
case CLOCK_MONOTONIC: