From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16696 invoked by alias); 23 Jun 2017 14:02:42 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 13277 invoked by uid 89); 23 Jun 2017 14:02:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1552, H*R:D*sourceware.org X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Jun 2017 14:02:34 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 047021F56B for ; Fri, 23 Jun 2017 14:02:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 047021F56B Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vinschen@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 047021F56B Received: from calimero.vinschen.de (ovpn-117-36.ams2.redhat.com [10.36.117.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3E1F83177 for ; Fri, 23 Jun 2017 14:02:32 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 86224A8036C; Fri, 23 Jun 2017 16:02:31 +0200 (CEST) Date: Fri, 23 Jun 2017 14:02:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Message-ID: <20170623140231.GE18863@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20170623092259.29325-1-sebastian.huber@embedded-brains.de> <20170623092259.29325-2-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Md/poaVZ8hnGTzuv" Content-Disposition: inline In-Reply-To: <20170623092259.29325-2-sebastian.huber@embedded-brains.de> User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017/txt/msg00457.txt.bz2 --Md/poaVZ8hnGTzuv Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1542 Hi Sebastian, On Jun 23 11:22, Sebastian Huber wrote: > This simplifies further changes in this area. >=20 > Signed-off-by: Sebastian Huber > --- > newlib/libc/stdio/findfp.c | 50 ++++++++++++++++++++++++++++++----------= ------ > 1 file changed, 33 insertions(+), 17 deletions(-) >=20 > diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c > index ecc65d6d3..601795098 100644 > --- a/newlib/libc/stdio/findfp.c > +++ b/newlib/libc/stdio/findfp.c > @@ -84,6 +84,36 @@ _DEFUN(std, (ptr, flags, file), > #endif > } >=20=20 > +static void > +stdin_init(FILE *ptr) > +{ > + std (ptr, __SRD, 0); > +} > + > +static void > +stdout_init(FILE *ptr) > +{ > + /* On platforms that have true file system I/O, we can verify > + whether stdout is an interactive terminal or not, as part of > + __smakebuf on first use of the stream. For all other platforms, > + we will default to line buffered mode here. Technically, POSIX > + requires both stdin and stdout to be line-buffered, but tradition > + leaves stdin alone on systems without fcntl. */ > +#ifdef HAVE_FCNTL > + std (ptr, __SWR, 1); > +#else > + std (ptr, __SWR | __SLBF, 1); > +#endif > +} > + > +static void > +stderr_init(FILE *ptr) > +{ > + /* POSIX requires stderr to be opened for reading and writing, even > + when the underlying fd 2 is write-only. */ > + std (ptr, __SRW | __SNBF, 2); > +} >. + Perhaps these func should be inline? Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --Md/poaVZ8hnGTzuv Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZTR93AAoJEPU2Bp2uRE+giTQP/1dTnv6mvlIKPqF3j0iZZAhh juw/b5loEu+aikRiT5KMJxR7KgIAzjduahhU7ShV1jMiAPtM09xZagimz2PxVuuz aESlAognXTy5cRsbKpp1G1H8XKf0iXRiin3H/gTCS9iuZjcWRBD4DqaAthdyPzWh yFXUuEjZ8tA6k/1GNa2GP6wO0ddGK8XOI/P294Q7RumUZAihc6pVgSmCD8NBikSE 7wtokQhiD9FpLlchQ2E93+Bgj27Vpyp+mp/Fa/ddOsKJM9FWC58YWi6m90i2HBLV j6jP+UUSk7qeJgjP+BYpY/2vU03CBEIb7utTSUapZVh6XF8eDYNdAphDhRIBXIjz UZGBP3TtRc4MRiutMKhKek6GhxXDS4HiSre3AbOX2fDrjmPlb5jKMMFUnLTmnPl2 6jwGa0+PE0s10L+V/7Gbr2XxfLaAHRh8fIvPwc+/E5kewu5r/WIITzHckCn/DEM6 nY2iN0tLgjB70UeLFV+EJS9J3e2D+59gjqWC/R5x5aHpauk4pUNWVI6JsEQ0oCed m9CIVOaCj1GWW6kTPY0TJE4p4jt1WV3yEoJMZ87xRvoH8so9/fWqxUTS3aiVVW7W 7LqJlRGsr1jC8UFqiULFWPJHIldo6ah14bbU8bEFgkGRHpg6HJPbWyWohe3ZYTud wSFeP8rGoNSn8kEZTt1W =7HPR -----END PGP SIGNATURE----- --Md/poaVZ8hnGTzuv--