* [Qemu-trivial] [PATCH] linux-user: pass correct host flags to eventfd2 call
@ 2013-04-08 18:26 Petar Jovanovic
2013-04-08 20:23 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2013-04-12 11:36 ` [Qemu-trivial] " Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Petar Jovanovic @ 2013-04-08 18:26 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, riku.voipio, petar.jovanovic, Petar Jovanovic
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>
---
linux-user/syscall.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH] linux-user: pass correct host flags to eventfd2 call
2013-04-08 18:26 [Qemu-trivial] [PATCH] linux-user: pass correct host flags to eventfd2 call Petar Jovanovic
@ 2013-04-08 20:23 ` Peter Maydell
2013-04-12 11:36 ` [Qemu-trivial] " Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2013-04-08 20:23 UTC (permalink / raw)
To: Petar Jovanovic; +Cc: qemu-trivial, riku.voipio, qemu-devel, petar.jovanovic
On 8 April 2013 19:26, Petar Jovanovic <petar.jovanovic@rt-rk.com> wrote:
> 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>
> ---
> linux-user/syscall.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> 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));
I had to look it up, but this is OK because eventfd flags come
in two flavours: (a) those shared with the O_* fcntl flags, which
is just O_NONBLOCK and O_CLOEXEC at the moment and (b) those which
are not shared with the fcntl flags, which are the same value on
all targets. So it's correct to convert the two shared flags and
leave the rest alone.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-trivial] [PATCH] linux-user: pass correct host flags to eventfd2 call
2013-04-08 18:26 [Qemu-trivial] [PATCH] linux-user: pass correct host flags to eventfd2 call Petar Jovanovic
2013-04-08 20:23 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
@ 2013-04-12 11:36 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2013-04-12 11:36 UTC (permalink / raw)
To: Petar Jovanovic; +Cc: qemu-trivial, riku.voipio, qemu-devel, petar.jovanovic
On Mon, Apr 08, 2013 at 08:26:10PM +0200, Petar Jovanovic wrote:
> 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>
> ---
> linux-user/syscall.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-12 11:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 18:26 [Qemu-trivial] [PATCH] linux-user: pass correct host flags to eventfd2 call Petar Jovanovic
2013-04-08 20:23 ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2013-04-12 11:36 ` [Qemu-trivial] " Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).