diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-11 12:01:42 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-11 12:01:42 +0100 |
commit | cf3d2411fafd7ab72791f3fd47fce1677268b8b2 (patch) | |
tree | 4afc501dee6e43437a9e5ce51bd644343482a3bf | |
parent | 723effd05152d2f9f2f8488b834a2ed2d88a4106 (diff) | |
download | serenity-cf3d2411fafd7ab72791f3fd47fce1677268b8b2.zip |
UserspaceEmulator: Implement the ftruncate and umask syscalls
It's now possible to copy files with FileManager running in UE. :^)
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 14 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index c0fc6828c6..8e3881ac40 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -534,6 +534,10 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$allocate_tls(arg1); case SC_beep: return virt$beep(); + case SC_ftruncate: + return virt$ftruncate(arg1, arg2); + case SC_umask: + return virt$umask(arg1); default: reportln("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}", getpid(), Syscall::to_string((Syscall::Function)function), function); dump_backtrace(); @@ -708,6 +712,16 @@ int Emulator::virt$get_stack_bounds(FlatPtr base, FlatPtr size) return 0; } +int Emulator::virt$ftruncate(int fd, off_t length) +{ + return syscall(SC_ftruncate, fd, length); +} + +mode_t Emulator::virt$umask(mode_t mask) +{ + return syscall(SC_umask, mask); +} + int Emulator::virt$accept(int sockfd, FlatPtr address, FlatPtr address_length) { socklen_t host_address_length = 0; diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index 4134a0a461..ff8fad1235 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -173,6 +173,8 @@ private: u32 virt$allocate_tls(size_t); int virt$ptsname(int fd, FlatPtr buffer, size_t buffer_size); int virt$beep(); + int virt$ftruncate(int fd, off_t); + mode_t virt$umask(mode_t); FlatPtr allocate_vm(size_t size, size_t alignment); bool find_malloc_symbols(const MmapRegion& libc_text); |