From b4d04fd8d1083e364d638df97941d52cb5c5c481 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 9 Aug 2020 12:42:51 -0700 Subject: Kernel: Use Userspace for the clock_gettime syscall --- Kernel/Process.h | 2 +- Kernel/Syscalls/clock.cpp | 5 ++--- 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); - int sys$clock_gettime(clockid_t, timespec*); + int sys$clock_gettime(clockid_t, Userspace); int sys$clock_settime(clockid_t, timespec*); int sys$clock_nanosleep(Userspace); 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 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: -- cgit v1.2.3