--- linux-user/main.c 2005-04-20 12:09:42.788531487 +0300 +++ linux-user/main.c 2005-04-20 12:00:43.541291763 +0300 @@ -25,6 +25,8 @@ #include #include "qemu.h" + +char *exec_path; #define DEBUG_LOGFILE "/tmp/qemu.log" @@ -1139,6 +1167,7 @@ if (optind >= argc) usage(); filename = argv[optind]; + exec_path = argv[optind]; modify_env(); --- linux-user/qemu.h 2005-02-07 14:35:39.000000000 +0200 +++ linux-user/qemu.h 2005-04-20 11:59:20.800454961 +0300 @@ -9,7 +9,9 @@ #include "cpu.h" #include "syscall.h" #include "gdbstub.h" + +extern char *exec_path; /* This struct is used to hold certain information about the image. * Basically, it replicates in user space what would be certain --- linux-user/syscall.c 2005-04-20 12:09:42.800529869 +0300 +++ linux-user/syscall.c 2005-04-20 11:58:08.643189872 +0300 @@ -2282,6 +2279,9 @@ goto unimplemented; #endif case TARGET_NR_readlink: - ret = get_errno(readlink(path((const char *)arg1), (char *)arg2, arg3)); - break; + if (strncmp((const char *)arg1, "/proc/self/exe", 14) == 0) + ret = get_errno(snprintf((char *)arg2, arg3, "%s", exec_path)); + else + ret = get_errno(readlink(path((const char *)arg1), (char *)arg2, arg3)); + break; case TARGET_NR_uselib: