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-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 501CA1F55B for ; Wed, 27 May 2020 09:16:12 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B31FA3955C34; Wed, 27 May 2020 09:16:09 +0000 (GMT) Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id BEF123887019 for ; Wed, 27 May 2020 09:16:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BEF123887019 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@gnu.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A820DD19D; Wed, 27 May 2020 11:16:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EIw5n5Z9wa2k; Wed, 27 May 2020 11:16:04 +0200 (CEST) Received: from function.home (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7FFD7D11D; Wed, 27 May 2020 11:16:04 +0200 (CEST) Received: from samy by function.home with local (Exim 4.93) (envelope-from ) id 1jdsAN-000mCW-EZ; Wed, 27 May 2020 11:16:03 +0200 Date: Wed, 27 May 2020 11:16:03 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: Re: [PATCH] Rearrange bsd_getpt vs bsd_openpt and implement posix_openbt on BSD Message-ID: <20200527091603.nnie4tluftke76dh@function> References: <20200526204300.10337-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200526204300.10337-1-samuel.thibault@ens-lyon.org> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) 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: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" (Sorry, exchanged the two file names while writing the changelog) Samuel Thibault, le mar. 26 mai 2020 22:43:00 +0200, a ecrit: > * sysdeps/unix/sysv/linux/getpt.c (__getpt): Add oflag parameter, pass > it to the _open call and rename to... > (__bsd_openpt): ... new function. > [!HAVE_GETPT] (__getpt): Reimplement on top of __bsd_openpt. > (__posix_openpt): Replace stub with implementation on top of __bsd_openpt. > (posix_openpt): Remove stub warning. that was for sysdeps/unix/bsd/getpt.c > * sysdeps/unix/bsd/getpt.c (__bsd_getpt): Replace prototype with > __bsd_openpt prototype. > (__getpt): Use __bsd_openpt instead of __bsd_getpt (as fallback when > _posix_openpt fails). > (getpt): Add alias > (__getpt): Do not define. > (HAVE_GETPT): Define. and that was for sysdeps/unix/sysv/linux/getpt.c > --- > sysdeps/unix/bsd/getpt.c | 18 ++++++++++-------- > sysdeps/unix/sysv/linux/getpt.c | 7 ++++--- > 2 files changed, 14 insertions(+), 11 deletions(-) > > diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c > index 75489aef28..45c91005af 100644 > --- a/sysdeps/unix/bsd/getpt.c > +++ b/sysdeps/unix/bsd/getpt.c > @@ -41,7 +41,7 @@ const char __libc_ptyname2[] attribute_hidden = PTYNAME2; > > /* Open a master pseudo terminal and return its file descriptor. */ > int > -__getpt (void) > +__bsd_openpt (int oflag) > { > char buf[sizeof (_PATH_PTY) + 2]; > const char *p, *q; > @@ -61,7 +61,7 @@ __getpt (void) > > s[1] = *q; > > - fd = __open (buf, O_RDWR); > + fd = __open (buf, oflag); > if (fd != -1) > return fd; > > @@ -74,18 +74,20 @@ __getpt (void) > return -1; > } > > -#undef __getpt > +#ifndef HAVE_GETPT > +int > +__getpt (void) > +{ > + return __bsd_openpt (O_RDWR); > +} > weak_alias (__getpt, getpt) > +#endif > > #ifndef HAVE_POSIX_OPENPT > -/* We cannot define posix_openpt in general for BSD systems. */ > int > __posix_openpt (int oflag) > { > - __set_errno (ENOSYS); > - return -1; > + return __bsd_openpt (oflag); > } > weak_alias (__posix_openpt, posix_openpt) > - > -stub_warning (posix_openpt) > #endif > diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c > index 1803b232c9..3785f90db0 100644 > --- a/sysdeps/unix/sysv/linux/getpt.c > +++ b/sysdeps/unix/sysv/linux/getpt.c > @@ -31,7 +31,7 @@ > #define _PATH_DEVPTS _PATH_DEV "pts" > > /* Prototype for function that opens BSD-style master pseudo-terminals. */ > -extern int __bsd_getpt (void) attribute_hidden; > +extern int __bsd_openpt (int oflag) attribute_hidden; > > /* Open a master pseudo terminal and return its file descriptor. */ > int > @@ -88,14 +88,15 @@ __getpt (void) > { > int fd = __posix_openpt (O_RDWR); > if (fd == -1) > - fd = __bsd_getpt (); > + fd = __bsd_openpt (O_RDWR); > return fd; > } > +weak_alias (__getpt, getpt) > > > #define PTYNAME1 "pqrstuvwxyzabcde"; > #define PTYNAME2 "0123456789abcdef"; > > -#define __getpt __bsd_getpt > +#define HAVE_GETPT > #define HAVE_POSIX_OPENPT > #include > -- > 2.26.2 > -- Samuel argh, pi est plus grand que 2. Ca casse tout -+- #ens-mim -+-