summaryrefslogtreecommitdiff
path: root/DevTools/UserspaceEmulator
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-27 23:41:01 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-28 00:03:25 +0200
commit9def88e08d40df06447d7f2e150d50d0bb37bbc7 (patch)
tree8ce597c3a6fd60291bd904152742e248f77e233a /DevTools/UserspaceEmulator
parent308d3b764f27427bcfc9f1177487856acf5f1cec (diff)
downloadserenity-9def88e08d40df06447d7f2e150d50d0bb37bbc7.zip
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.
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp10
1 files 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)