mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
Kernel: Use Userspace<T> for the clock_gettime syscall
This commit is contained in:
parent
48d9f3c2e6
commit
b4d04fd8d1
Notes:
sideshowbarker
2024-07-19 04:06:01 +09:00
Author: https://github.com/bgianfo
Commit: b4d04fd8d1
Pull-request: https://github.com/SerenityOS/serenity/pull/3062
Reviewed-by: https://github.com/awesomekling
2 changed files with 3 additions and 4 deletions
|
@ -247,7 +247,7 @@ public:
|
||||||
int sys$sleep(unsigned seconds);
|
int sys$sleep(unsigned seconds);
|
||||||
int sys$usleep(useconds_t usec);
|
int sys$usleep(useconds_t usec);
|
||||||
int sys$gettimeofday(Userspace<timeval*>);
|
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_settime(clockid_t, timespec*);
|
||||||
int sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*>);
|
int sys$clock_nanosleep(Userspace<const Syscall::SC_clock_nanosleep_params*>);
|
||||||
int sys$gethostname(char*, ssize_t);
|
int sys$gethostname(char*, ssize_t);
|
||||||
|
|
|
@ -29,14 +29,13 @@
|
||||||
|
|
||||||
namespace Kernel {
|
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);
|
REQUIRE_PROMISE(stdio);
|
||||||
if (!validate_write_typed(user_ts))
|
if (!validate_write_typed(user_ts))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
timespec ts;
|
timespec ts = {};
|
||||||
memset(&ts, 0, sizeof(ts));
|
|
||||||
|
|
||||||
switch (clock_id) {
|
switch (clock_id) {
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue