From aa07f5ecf9828bb2ff8d796cb0b17ad8534201c7 Mon Sep 17 00:00:00 2001 From: Maxim Ostapenko Date: Fri, 2 May 2014 11:17:07 +0300 Subject: [PATCH] linux-user: Add /proc/self/exe open forwarding 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 Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9864813b7a..5203cc4577 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;