public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS
Date: Thu, 29 Jun 2017 18:31:00 -0000	[thread overview]
Message-ID: <20170629183138.GY6201@calimero.vinschen.de> (raw)
In-Reply-To: <20170629122002.25614-3-sebastian.huber@embedded-brains.de>

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

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).
> 
> (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.
> 
> (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().
> 
> Introduce a new Newlib configuration option _REENT_GLOBAL_STDIO_STREAMS
> to enable the use of global stdio FILE objects.
> 
> As a side-effect this reduces the size of struct _reent by more than
> 50%.
> 
> 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

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-06-29 18:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 12:25 [PATCH v3 1/5] Remove superfluous parameter from std() Sebastian Huber
2017-06-29 12:25 ` [PATCH v3 3/5] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
2017-06-29 18:31   ` Corinna Vinschen [this message]
2017-06-30  5:43     ` Sebastian Huber
2017-06-30  8:13       ` Corinna Vinschen
2017-06-30  8:58         ` Sebastian Huber
2017-06-30 10:35           ` Corinna Vinschen
2018-08-08 14:10           ` Freddie Chopin
2018-08-08 15:20             ` Sebastian Huber
2018-08-09  4:59               ` Freddie Chopin
2018-08-09  6:09                 ` Sebastian Huber
2017-06-29 12:25 ` [PATCH v3 5/5] Add --enable-newlib-global-stdio-streams Sebastian Huber
2017-06-29 12:25 ` [PATCH v3 4/5] Enable _REENT_GLOBAL_STDIO_STREAMS for RTEMS Sebastian Huber
2017-06-29 12:25 ` [PATCH v3 2/5] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170629183138.GY6201@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).