From fcc38422c6b6ed3deabf18fff98c6db9d0d68d54 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sat, 24 Oct 2020 11:25:58 +0330 Subject: UserspaceEmulator: Add support for set_thread_name It should be noted that creating threads is still not supported. --- DevTools/UserspaceEmulator/Emulator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'DevTools/UserspaceEmulator/Emulator.cpp') 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 #include #include +#include #include #include #include @@ -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()); +} + } -- cgit v1.2.3