diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-10-24 11:25:58 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-25 10:13:03 +0100 |
commit | fcc38422c6b6ed3deabf18fff98c6db9d0d68d54 (patch) | |
tree | e1f5cc9b9f8a4e1bee853b7509e459c9803c8e2e /DevTools/UserspaceEmulator/Emulator.cpp | |
parent | 617c5ba0451ed021b19f6a99872cac4bc629e9d7 (diff) | |
download | serenity-fcc38422c6b6ed3deabf18fff98c6db9d0d68d54.zip |
UserspaceEmulator: Add support for set_thread_name
It should be noted that creating threads is still not supported.
Diffstat (limited to 'DevTools/UserspaceEmulator/Emulator.cpp')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index d90a087d29..10a9b7de72 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -32,6 +32,7 @@ #include <AK/Format.h> #include <AK/LexicalPath.h> #include <Kernel/API/Syscall.h> +#include <LibPthread/pthread.h> #include <LibX86/ELFSymbolProvider.h> #include <fcntl.h> #include <net/if.h> @@ -392,6 +393,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$sched_getparam(arg1, arg2); case SC_sched_setparam: return virt$sched_setparam(arg1, arg2); + case SC_set_thread_name: + return virt$set_thread_name(arg1, arg2, arg3); default: reportln("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}", getpid(), Syscall::to_string((Syscall::Function)function), function); dump_backtrace(); @@ -1450,4 +1453,11 @@ int Emulator::virt$sched_setparam(int pid, FlatPtr user_addr) return syscall(SC_sched_setparam, pid, &user_param); } +int Emulator::virt$set_thread_name(pid_t pid, FlatPtr name_addr, size_t name_length) +{ + auto user_name = mmu().copy_buffer_from_vm(name_addr, name_length); + auto name = String::formatted("(UE) {}", StringView { user_name.data(), user_name.size() }); + return syscall(SC_set_thread_name, pid, name.characters(), name.length()); +} + } |