diff options
author | Brendan Coles <bcoles@gmail.com> | 2021-01-10 16:00:34 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-10 18:20:29 +0100 |
commit | b53664a8ef4e93e49240a2973f3b8a2bb629dc1f (patch) | |
tree | 1a42e5b0e1c3dc38fcf8c0730c12e7c9380cb247 | |
parent | 700f21301116558829466af0644f5685beb0ab67 (diff) | |
download | serenity-b53664a8ef4e93e49240a2973f3b8a2bb629dc1f.zip |
UserspaceEmulator: Implement clock_settime syscall
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 10 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 6ea2b9bff0..c0fc6828c6 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -508,6 +508,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$gettimeofday(arg1); case SC_clock_gettime: return virt$clock_gettime(arg1, arg2); + case SC_clock_settime: + return virt$clock_settime(arg1, arg2); case SC_getrandom: return virt$getrandom(arg1, arg2, arg3); case SC_fork: @@ -767,6 +769,14 @@ int Emulator::virt$clock_gettime(int clockid, FlatPtr timespec) return rc; } +int Emulator::virt$clock_settime(uint32_t clock_id, FlatPtr user_ts) +{ + struct timespec user_timespec; + mmu().copy_from_vm(&user_timespec, user_ts, sizeof(user_timespec)); + int rc = syscall(SC_clock_settime, clock_id, &user_timespec); + return rc; +} + int Emulator::virt$set_mmap_name(FlatPtr) { // FIXME: Implement. diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index de8e42f3a8..4134a0a461 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -135,6 +135,7 @@ private: int virt$chmod(FlatPtr, size_t, mode_t); int virt$fchmod(int, mode_t); int virt$fchown(int, uid_t, gid_t); + int virt$clock_settime(uint32_t clock_id, FlatPtr user_ts); int virt$listen(int, int); int virt$kill(pid_t, int); int virt$fstat(int, FlatPtr); |