qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 01/14] linux-user: Add /proc/self/exe open forwarding


From: riku . voipio
Subject: [Qemu-devel] [PULL 01/14] linux-user: Add /proc/self/exe open forwarding
Date: Fri, 2 May 2014 22:15:36 +0300

From: Maxim Ostapenko <address@hidden>

QEMU already supports /proc/self/{maps,stat,auxv} so addition of
/proc/self/exe is rather trivial.

Fixes https://bugs.launchpad.net/qemu/+bug/1299190

Signed-off-by: Maxim Ostapenko <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
 linux-user/syscall.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9864813..5203cc4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5225,6 +5225,11 @@ static int do_open(void *cpu_env, const char *pathname, 
int flags, mode_t mode)
         { NULL, NULL, NULL }
     };
 
+    if (is_proc_myself(pathname, "exe")) {
+        int execfd = qemu_getauxval(AT_EXECFD);
+        return execfd ? execfd : get_errno(open(exec_path, flags, mode));
+    }
+
     for (fake_open = fakes; fake_open->filename; fake_open++) {
         if (fake_open->cmp(pathname, fake_open->filename)) {
             break;
-- 
2.0.0.rc0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]