From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 411701F601 for ; Mon, 5 Dec 2022 16:43:02 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="u7HMo6Hk"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E1E1394740E for ; Mon, 5 Dec 2022 16:43:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E1E1394740E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670258581; bh=DY0M6oYzo2ToqAEZgbQ2lFV3ZglfYclyZ7RJetkMM7E=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=u7HMo6Hk80vxWIRQhNtXgdvpMZpUimor4etDG3kbKvJ5XaFG8dVoDhOgcijzYHKL9 zEYBKrPZewZsvifrWXgBfnAtPe6otu3xXQ/hNAgQqG4zpzfJ/WnO+mS8UViK0K9oDp 8wF9+DNV0WiZDy4ECL+f9UyAAXPq3JZCx7SF+/mk= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7CBDE3945C3A for ; Mon, 5 Dec 2022 16:40:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7CBDE3945C3A Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-313-_VwXJuenPuKZzm-kqy02Hg-1; Mon, 05 Dec 2022 11:40:15 -0500 X-MC-Unique: _VwXJuenPuKZzm-kqy02Hg-1 Received: by mail-il1-f199.google.com with SMTP id i14-20020a056e020d8e00b003034b93bd07so5719582ilj.14 for ; Mon, 05 Dec 2022 08:40:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DY0M6oYzo2ToqAEZgbQ2lFV3ZglfYclyZ7RJetkMM7E=; b=pSnXkgvXTGDX5/9Zgl+b/+DAGEQOggYkYU8dFaN+iAAbf9IFBO5yx1pr79+L2c3aYP 3j5TO6TLKPmqu0ZZxu9f2KfMWEkwAqDh2EXi22E300WZ59IRlQ/cN26VepRQbAwtaaGg 3nfFhxveVCHDuLAmHPb77QgvENL6Spv0mbF+BADsVkzu9ub9RDE/UQ2XXgOgUdyu+K2w tVquZURdW1qZf0AQjxN8Z2nEwwldLj1MOIzAhUFJBv8TkWFgOcwRRmAmg8Q9mLFc9Cw2 GQpMiA0B4WVPI9QcbmN+kcxE/WdEO82OVEWGoIecIWqLVVyGG/laKpEfebdjW0sSBFDA AjRQ== X-Gm-Message-State: ANoB5pmTwo8Yolqd4p0vJVDSW5ioI1C27993gIz5df4u+r9Xv8BpKkxN zRD5WBIO/0Mr2VdLDLw2cmmiDsnypBAK0V2nZOMkMJfQjduV6cR7C1n7bKU2cnhhFxG3R9S8Uqc Dsxhfs4kK3FN0EGY61Bp2 X-Received: by 2002:a6b:8d09:0:b0:68b:7b1f:92b9 with SMTP id p9-20020a6b8d09000000b0068b7b1f92b9mr29801269iod.163.1670258414250; Mon, 05 Dec 2022 08:40:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4GF23yaQgGwTwpa4dWY17RBaaJ6EiI9THKhvr2X6fwynZ+nIQ2985Ll/jgnM7yvFti7IwthQ== X-Received: by 2002:a6b:8d09:0:b0:68b:7b1f:92b9 with SMTP id p9-20020a6b8d09000000b0068b7b1f92b9mr29801264iod.163.1670258413971; Mon, 05 Dec 2022 08:40:13 -0800 (PST) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id c17-20020a92d3d1000000b00302e4c93a54sm5296032ilh.79.2022.12.05.08.40.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Dec 2022 08:40:13 -0800 (PST) Message-ID: <4fe0b2b7-9a79-7e6c-fe26-c0a649bc3631@redhat.com> Date: Mon, 5 Dec 2022 11:40:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 05/30] Linux: consolidate dup2 implementation To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20221019221433.1082017-1-adhemerval.zanella@linaro.org> <20221019221433.1082017-6-adhemerval.zanella@linaro.org> Organization: Red Hat In-Reply-To: <20221019221433.1082017-6-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote: > Use dup2 syscall if defined, otherwise use dup3. > > Checked on x86_64-linux-gnu. LGTM. No regressions on x86_64 and i686. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell > --- > sysdeps/unix/sysv/linux/{generic => }/dup2.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > rename sysdeps/unix/sysv/linux/{generic => }/dup2.c (83%) > > diff --git a/sysdeps/unix/sysv/linux/generic/dup2.c b/sysdeps/unix/sysv/linux/dup2.c > similarity index 83% > rename from sysdeps/unix/sysv/linux/generic/dup2.c > rename to sysdeps/unix/sysv/linux/dup2.c > index 0dc45e9b17..1182780e15 100644 > --- a/sysdeps/unix/sysv/linux/generic/dup2.c > +++ b/sysdeps/unix/sysv/linux/dup2.c > @@ -1,4 +1,5 @@ > -/* Copyright (C) 2011-2022 Free Software Foundation, Inc. > +/* Duplicate a file descriptor. Linux version. > + Copyright (C) 2011-2022 Free Software Foundation, Inc. > This file is part of the GNU C Library. > > The GNU C Library is free software; you can redistribute it and/or > @@ -24,12 +25,16 @@ > int > __dup2 (int fd, int fd2) > { > +#ifdef __NR_dup2 > + return INLINE_SYSCALL_CALL (dup2, fd, fd2); OK. > +#else > /* For the degenerate case, check if the fd is valid (by trying to > get the file status flags) and return it, or else return EBADF. */ > if (fd == fd2) > return __libc_fcntl (fd, F_GETFL, 0) < 0 ? -1 : fd; > > - return INLINE_SYSCALL (dup3, 3, fd, fd2, 0); > + return INLINE_SYSCALL_CALL (dup3, fd, fd2, 0); OK. > +#endif > } > libc_hidden_def (__dup2) > weak_alias (__dup2, dup2) -- Cheers, Carlos.