From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75544 invoked by alias); 29 Jun 2017 18:31:43 -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 75510 invoked by uid 89); 29 Jun 2017 18:31:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*c:application 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; Thu, 29 Jun 2017 18:31:41 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25FC52DA435 for ; Thu, 29 Jun 2017 18:31:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 25FC52DA435 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vinschen@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 25FC52DA435 Received: from calimero.vinschen.de (ovpn-117-36.ams2.redhat.com [10.36.117.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id C41655C46E for ; Thu, 29 Jun 2017 18:31:39 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 854B6A805F0; Thu, 29 Jun 2017 20:31:38 +0200 (CEST) Date: Thu, 29 Jun 2017 18:31:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS Message-ID: <20170629183138.GY6201@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20170629122002.25614-1-sebastian.huber@embedded-brains.de> <20170629122002.25614-3-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8EXHJdkEfksMlRxO" Content-Disposition: inline In-Reply-To: <20170629122002.25614-3-sebastian.huber@embedded-brains.de> User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017/txt/msg00528.txt.bz2 --8EXHJdkEfksMlRxO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1558 On Jun 29 14:20, Sebastian Huber wrote: > In Newlib, the stdio streams are defined to thread-specific pointers > _reent::_stdin, _reent::_stdout and _reent::_stderr. In case > _REENT_SMALL is not defined, then these pointers are initialized via > _REENT_INIT_PTR() or _REENT_INIT_PTR_ZEROED() to thread-specific FILE > objects provided via _reent::__sf[3]. There are two problems with this > (at least in case of RTEMS). >=20 > (1) The thread-specific FILE objects are closed by _reclaim_reent(). > This leads to problems with language run-time libraries that provide > wrappers to the C/POSIX stdio streams (e.g. C++ and Ada), since they > use the thread-specific FILE objects of the initialization thread. In > case the initialization thread is deleted, then they use freed memory. >=20 > (2) Since thread-specific FILE objects are used with a common output > device via file descriptors 0, 1 and 2, the locking at FILE object level > cannot ensure atomicity of the output, e.g. a call to printf(). >=20 > Introduce a new Newlib configuration option _REENT_GLOBAL_STDIO_STREAMS > to enable the use of global stdio FILE objects. >=20 > As a side-effect this reduces the size of struct _reent by more than > 50%. >=20 > The _REENT_GLOBAL_STDIO_STREAMS should not be used without > _STDIO_CLOSE_PER_REENT_STD_STREAMS. Patch series looks good, builds and works on Cygwin, so I think this is good to go. Please push. And, JFYI, Cygwin will start to use it too after the next release :) Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --8EXHJdkEfksMlRxO Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZVUeKAAoJEPU2Bp2uRE+gMGYP/Rz/wBTDrGqMuSlXo27ygzTn My+bQZeMy2RiIEKAmQRjjI+125mBniYF91PnI3Llcb8DZMStU2a8+XSG3K6bJhfu nHt55b4TQpfFqCqry8mrbT0fpppMlrZpVQO7ISgQpycp3ODKqiIXsoFoucWXOW81 +fm8a8JUtAZVJRol6tlfw/x8DrbP9OXMcDJxvvbRLUzU9/0YGA5UfiPQ14xyBfXT sUa1HCxYdxuHpyxU0po9o/X/VR6VpQRPIbTVHhppD73ehEZGZaoDdPmTm8Mkxusf VcFn7d5m0keCUwXQYsYvKb3r9aCr+A4DOZ5F+mpHOGk52evgNqK1nVJjtmiO/onH QwR3jJwMMuwnLo04U+l7LZM93/gR8OlnCTCpN2Wm2gTS0Tf3Uh3wRv5u+Vil4PjB 1iGf7pO01NYJik4ezdA6jflJYftf6GRYW/vf6UVvc2UJxM5a3m2PnWRrK+akAxxZ oBpkDGlia0lh6DMKb2GAiHbXDWXmf3kuCi9ZGZKulNBgW9LQ7JoSNFwuuebS4MPL H6RWdO3RvY7kNROB+WrWLgpL/fZWcUsfwOilNSFNdRzDecSRfPKV/zboGPW7tKGk Cvumi7+TyK5/TDsvn1NZ/g1lRQFBofH8XF0k18qpC6z3SwaxHbTBuUUePlkFhcx7 AGjHjl3RXX+CWjTFeZmW =BQaT -----END PGP SIGNATURE----- --8EXHJdkEfksMlRxO--