aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorMaxim Ostapenko <m.ostapenko@partner.samsung.com>2014-05-02 11:17:07 +0300
committerRiku Voipio <riku.voipio@linaro.org>2014-05-02 21:59:27 +0300
commitaa07f5ecf9828bb2ff8d796cb0b17ad8534201c7 (patch)
tree13190a4de5e56241a320a2fee69cc3a1f1c05e5f /linux-user
parentfdaad4715ae9e998fd0595bedfb16fdaf0c68ccc (diff)
downloadqemu-aa07f5ecf9828bb2ff8d796cb0b17ad8534201c7.zip
qemu-aa07f5ecf9828bb2ff8d796cb0b17ad8534201c7.tar.gz
qemu-aa07f5ecf9828bb2ff8d796cb0b17ad8534201c7.tar.bz2
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 <m.ostapenko@partner.samsung.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c5
1 files changed, 5 insertions, 0 deletions
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;