qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Subject: [PATCH] linux-user: Fix pipe() vs. pipe2() usage for ALPHA, MIPS, SH4 and SPARC
Date: Sun, 17 Jul 2022 18:08:06 +0200	[thread overview]
Message-ID: <YtQzMUuBOfBiMNlY@p100> (raw)

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


             reply	other threads:[~2022-07-17 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 16:08 Helge Deller [this message]
2022-07-17 16:37 ` [PATCH] linux-user: Fix pipe() vs. pipe2() usage for ALPHA, MIPS, SH4 and SPARC 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtQzMUuBOfBiMNlY@p100 \
    --to=deller@gmx.de \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).