summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp10
-rw-r--r--DevTools/UserspaceEmulator/Emulator.h1
2 files changed, 11 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());
+}
+
}
diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h
index e31c37f5b6..cefa9d6ca4 100644
--- a/DevTools/UserspaceEmulator/Emulator.h
+++ b/DevTools/UserspaceEmulator/Emulator.h
@@ -152,6 +152,7 @@ private:
int virt$getsid(pid_t);
int virt$sched_setparam(int, FlatPtr);
int virt$sched_getparam(pid_t, FlatPtr);
+ int virt$set_thread_name(pid_t, FlatPtr, size_t);
FlatPtr allocate_vm(size_t size, size_t alignment);