This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>, newlib at sourceware dot org
- Date: Wed, 08 Aug 2018 15:19:28 +0200
- Subject: Re: [PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS
- References: <20170629122002.25614-1-sebastian.huber@embedded-brains.de> <20170629122002.25614-3-sebastian.huber@embedded-brains.de> <20170629183138.GY6201@calimero.vinschen.de> <e59a7f58-87f7-bf69-819e-16450d507c51@embedded-brains.de> <20170630081306.GA6201@calimero.vinschen.de> <1068535433.14282.1498813082840.JavaMail.zimbra@embedded-brains.de>
On Fri, 2017-06-30 at 10:58 +0200, Sebastian Huber wrote:
>
> ----- Am 30. Jun 2017 um 10:13 schrieb Corinna Vinschen
> vinschen@redhat.com:
>
> > On Jun 30 07:43, Sebastian Huber wrote:
> > > On 29/06/17 20:31, Corinna Vinschen wrote:
> > >
> > > > And, JFYI, Cygwin will start to use it too after the next
> > > > release:)
> > >
> > > There are some new problems with this change. We have no
> > > reference counting
> > > in the FILE objects, so a freopen(..., stdin), closes the global
> > > stdin FILE
> > > object (__sf[0]), etc. What works is a stdin = fopen(). I guess
> > > this could
> > > break existing applications.
> >
> > Erm... isn't that expected behaviour? stdin/stdout/stderr are
> > global
> > objects, after all. They were never thread-local per POSIX.
>
> The stdin/stdout/stderr pointers are still thread-local with this
> option. Only the FILE objects itself are now global. If you do a
> stdin = fopen() you get a completely thread-local stdin. I have
> absolutely no idea why this stuff is thread-local in Newlib by
> default.
Would that be possible, to make stdin/stdout/stderr completely global
(remove them from _reent, use global objects) when
_REENT_GLOBAL_STDIO_STREAMS is enabled?
Regards,
FCh