diff options
author | Petar Jovanovic <petar.jovanovic@rt-rk.com> | 2013-04-08 20:26:10 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-04-12 14:33:20 +0200 |
commit | 5947c697ce71898015ae1c6ac5d23d1ecc388552 (patch) | |
tree | efe4aa208f801e8d100e9a907f7c1f7d9d494ba2 /linux-user | |
parent | 183543cdb68a0f2e1ff1c68d37338037dcc9d6c5 (diff) | |
download | qemu-5947c697ce71898015ae1c6ac5d23d1ecc388552.zip qemu-5947c697ce71898015ae1c6ac5d23d1ecc388552.tar.gz qemu-5947c697ce71898015ae1c6ac5d23d1ecc388552.tar.bz2 |
linux-user: pass correct host flags to eventfd2 call
This change makes conversion of TARGET_O_NONBLOCK and TARGET_O_CLOEXEC flags
to host flags before calling eventfd for TARGET_NR_eventfd2.
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/syscall.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ee82a2d..1f07621 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8823,8 +8823,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #endif #if defined(TARGET_NR_eventfd2) case TARGET_NR_eventfd2: - ret = get_errno(eventfd(arg1, arg2)); + { + int host_flags = arg2 & (~(TARGET_O_NONBLOCK | TARGET_O_CLOEXEC)); + if (arg2 & TARGET_O_NONBLOCK) { + host_flags |= O_NONBLOCK; + } + if (arg2 & TARGET_O_CLOEXEC) { + host_flags |= O_CLOEXEC; + } + ret = get_errno(eventfd(arg1, host_flags)); break; + } #endif #endif /* CONFIG_EVENTFD */ #if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) |