Преглед изворни кода

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.
Andreas Kling пре 5 година
родитељ
комит
9def88e08d
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      DevTools/UserspaceEmulator/Emulator.cpp

+ 6 - 4
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)