diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-03-10 17:55:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-11 08:54:54 +0100 |
commit | d5925f33aaaf81f09236fa0ca9bb7d527b486ddd (patch) | |
tree | 9b18ad085e31f51af9b3081beed1493daa7d6a93 /Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | |
parent | ec8e3edd05280704cdbc16ac327ade7de7ef2711 (diff) | |
download | serenity-d5925f33aaaf81f09236fa0ca9bb7d527b486ddd.zip |
UserspaceEmulator: Implement set_process_name syscall
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index 586593cbb0..dda6fced3d 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -168,6 +168,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$getsockopt(arg1); case SC_get_process_name: return virt$get_process_name(arg1, arg2); + case SC_set_process_name: + return virt$set_process_name(arg1, arg2); case SC_dbgputstr: return virt$dbgputstr(arg1, arg2); case SC_dbgputch: @@ -481,6 +483,15 @@ int Emulator::virt$get_process_name(FlatPtr buffer, int size) return rc; } +int Emulator::virt$set_process_name(FlatPtr user_buffer, int size) +{ + if (size < 0) + return -EINVAL; + auto host_buffer = mmu().copy_buffer_from_vm(user_buffer, size); + auto name = String::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() }); + return syscall(SC_set_process_name, name.characters(), name.length()); +} + int Emulator::virt$lseek(int fd, off_t offset, int whence) { return syscall(SC_lseek, fd, offset, whence); |