From patchwork Tue Jul 19 16:20:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 12922727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AF56C433EF for ; Tue, 19 Jul 2022 16:22:41 +0000 (UTC) Received: from localhost ([::1]:55326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDpzc-0003Rv-H5 for qemu-devel@archiver.kernel.org; Tue, 19 Jul 2022 12:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDpxr-0000T0-0D for qemu-devel@nongnu.org; Tue, 19 Jul 2022 12:20:51 -0400 Received: from mout.gmx.net ([212.227.15.18]:51109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDpxo-0004eK-UR for qemu-devel@nongnu.org; Tue, 19 Jul 2022 12:20:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1658247644; bh=yWeGNUsme9QtNtOs2PC96LsvCqKBgtq0MiBKSHU8ZZE=; h=X-UI-Sender-Class:Date:From:To:Subject; b=KPHWmFR93yMJvkJRZio2v2ouR8BGS4HhjS3yTtSRGagQt4xjerIEuGNP5EUYJXzep pNZJ6yj3jkQNOnqbka0wZ2fsBECMHBeuYpZBeD06jVpl749uSNziMrR3Eh53DrWHbq f2NpOOET9RynvZGsFZwsfqjGK7VHxOK4kLom/LKA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from p100 ([92.116.145.26]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MUGi9-1o4jHD13ch-00RIDo; Tue, 19 Jul 2022 18:20:44 +0200 Date: Tue, 19 Jul 2022 18:20:42 +0200 From: Helge Deller To: Laurent Vivier , qemu-devel@nongnu.org, Peter Maydell Subject: [PATCH v2] linux-user: Unconditionally use pipe2() syscall Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:aR0YP7UziQ1Z/I4Zz04gHAfPH5gIXEFx71Tg6b2Mfm2mVVYrLjW Z47TplTw0mQYAMOP0eShKfDEIIFw4NYp6t7n9j9lHbfu+HgDrTrRi1BfwAhqRyenGX/7DMd T/G7Ccj2gbk7q3D+sRdX5DYNsLs96fBvQa1QEF5B+Zukwk9wOvenxhE1BX6yDy3oQxKaIV8 X7hTQPmpK8mwUQFpeszxw== X-UI-Out-Filterresults: notjunk:1;V03:K0:J6beG+m0bws=:l1IDCuI80aGStxJhNQqMxH oDTs87ZHzUHuGIBIgriF/jtywKgzYJS+/qCGmFroXkodMnC7hjiC/1JREGCCJqM/RYRkQS4BE cmr4XF/f7S6PAWGh/N6bmSF7WJNwHTVzGiYY1ppTQc7fpWo2MAsuWz2dlCq694KF0F3i4ZWqH zu8JbZoTgtNaB3So/ggwJJArlC0XKWlY+liVfRbmfbmj9Tm6j6XAsz1l3cD1sGOxPOEpeP1ro hA6eN2OtJqsFMBtvjvH+qZrrvR4/NFhkQC0zFPE7Qhs2/xjWtrX7NlOu9O4DBYeLFwuqNRtAO m/EbmLT8o2WKX2dI02kuHUyUt/iplVNEBFhX17olaQgf5x+wUlmucM2kX7IKtMjCI4MsMP/NR WOXdsqUq+EXiNoMgrYAbDgA3rCXCSXwxRzXs07hjk9zNG01zybi/TWW4ctZBaCfj/xEE3g5JO 507z19itLGv1fS0mf6QhVPbrTjF9Gh6jsAZIUJAUmX9jfAgwReA6kCJ4C5hHRq8rFjayxKzZv AYQ1EoeoSs/JJ34mZ1ZvLIMt0UfgmDeNQfKY0saXcuBPe8fge9G72oPyCQxS5md3iO/tNO6A5 i1FWjpruNTcf0xtMJ8hb0nq31TCq+Ot1iU0+K26LFpG95p2wsGOnFc+JCxBdwg4SDBx6ufRR+ gXMudlLzfwKhc0EDH+O7AUMlf7NnrjNyGSPv4ErzXgiBkSuOce0G92F0NuTOUUcgqPbTxxYHq auPNmhTWQpaBmE6uHOlXrdUKq1Sy0oQkST1HGIoQ8MD0hsRXBmHEjJyL3aZ3oYIMjJjiAc7Dg xNRB01q2zwqFePCs/D3XcXoI1xEbHwQ/6m1RBg9hfy3PsncdGJ0RvfpvohmlIv1zZAzUkG1u6 aqD5SMC3HXu7Vp1K7MEAbYSDlXi7z7X/vwp5B2PDjMF69HCQbVkMik1rFDPbdiJVE7OoLA8g/ O3U7CX7oLNV8WPPRuL4xccVLvexZ3ZGA9BlifMNCBWJscdVT6XeOUGJQU7cKfR3yI9sW2BEYL ztbtvdsLJGg02r50qtDAZWp411rC1BOM5NN1Oj4V8FvCIcPl8AO6JJef0OM8obsQuQvckcDAd trL/uvXeblil4bPhWSacHP1GSoEHG1Znqihj7skOONygBmnS16NKkydqA== Received-SPF: pass client-ip=212.227.15.18; envelope-from=deller@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The pipe2() syscall is available on all Linux platforms since kernel 2.6.27, so use it unconditionally to emulate pipe() and pipe2(). Signed-off-by: Helge Deller Reviewed-by: Peter Maydell --- Changes in v2: - added Reviewed-by: from Peter - new diff against git head - no functional changes diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 991b85e6b4..4f89184d05 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1586,21 +1586,12 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2, abi_long arg3, } #endif -static abi_long do_pipe2(int host_pipe[], int flags) -{ -#ifdef CONFIG_PIPE2 - return pipe2(host_pipe, flags); -#else - return -ENOSYS; -#endif -} - static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes, int flags, int is_pipe2) { int host_pipe[2]; abi_long ret; - ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe); + ret = pipe2(host_pipe, flags); if (is_error(ret)) return get_errno(ret); diff --git a/meson.build b/meson.build index 8a8c415fc1..75aaca8462 100644 --- a/meson.build +++ b/meson.build @@ -2026,15 +2026,6 @@ config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix + ''' #else int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } #endif''')) -config_host_data.set('CONFIG_PIPE2', cc.links(gnu_source_prefix + ''' - #include - #include - - int main(void) - { - int pipefd[2]; - return pipe2(pipefd, O_CLOEXEC); - }''')) config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + ''' #include #include