From 9def88e08d40df06447d7f2e150d50d0bb37bbc7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 27 Jul 2020 23:41:01 +0200 Subject: [PATCH] UserspaceEmulator: Don't just return "EMULATED" in get_process_name() Now that emulated processes have their real name (with a "(UE)" prefix) we can actually let them know their name. --- DevTools/UserspaceEmulator/Emulator.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 26b64065cd..ad2b451fc0 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -559,10 +559,12 @@ int Emulator::virt$set_mmap_name(FlatPtr) int Emulator::virt$get_process_name(FlatPtr buffer, int size) { - if (size < 9) - return -ENAMETOOLONG; - mmu().copy_to_vm(buffer, "EMULATED", 9); - return 0; + if (size < 0) + return -EINVAL; + auto host_buffer = ByteBuffer::create_zeroed((size_t)size); + int rc = syscall(SC_get_process_name, host_buffer.data(), host_buffer.size()); + mmu().copy_to_vm(buffer, host_buffer.data(), host_buffer.size()); + return rc; } int Emulator::virt$lseek(int fd, off_t offset, int whence)