qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: Fix pipe() vs. pipe2() usage for ALPHA, MIPS, SH4 and SPARC
@ 2022-07-17 16:08 Helge Deller
  2022-07-17 16:37 ` Helge Deller
  2022-07-18 12:51 ` Peter Maydell
  0 siblings, 2 replies; 8+ messages in thread
From: Helge Deller @ 2022-07-17 16:08 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel

In 2010, the commit b41a66edd0c added a thrird parameter "is_pipe2" to the
internal do_pipe() function, but missed to actually use this parameter to
decide if the pipe() or pipe2() syscall should be used.
Instead it just continued to check the flags parameter and used pipe2()
unconditionally if flags is non-zero.

This change should make a difference for the ALPHA, MIPS, SH4 and SPARC
targets if the emulated code calls pipe2() with a flags value of 0.

Fixes: fb41a66edd0c ("alpha-linux-user: Fix pipe return mechanism.")
Cc: Richard Henderson <rth@twiddle.net>
Cc: Aurelien Jarno <aurelien@aurel32.net>

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 991b85e6b4..1e6e814871 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1600,7 +1600,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes,
 {
     int host_pipe[2];
     abi_long ret;
-    ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe);
+    ret = is_pipe2 ? do_pipe2(host_pipe, flags) : pipe(host_pipe);

     if (is_error(ret))
         return get_errno(ret);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-18 16:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-17 16:08 [PATCH] linux-user: Fix pipe() vs. pipe2() usage for ALPHA, MIPS, SH4 and SPARC Helge Deller
2022-07-17 16:37 ` Helge Deller
2022-07-18 12:51 ` Peter Maydell
2022-07-18 14:21   ` Helge Deller
2022-07-18 14:33     ` Peter Maydell
2022-07-18 15:49       ` Helge Deller
2022-07-18 16:17         ` Peter Maydell
2022-07-18 16:25           ` Helge Deller

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).