4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00
Sebastian Huber 668a4c8722 Introduce _REENT_GLOBAL_STDIO_STREAMS
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.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30 07:45:16 +02:00
..
2017-06-30 07:45:16 +02:00
2016-04-04 10:25:27 -05:00
2017-03-22 10:03:45 +01:00
2016-03-17 21:08:56 -05:00
2015-08-27 12:50:25 +02:00
2015-07-06 14:58:51 -05:00
2017-03-22 10:03:45 +01:00
2016-11-22 14:21:35 +01:00
2016-03-17 21:09:01 -05:00
2016-10-25 16:24:05 +02:00
2017-04-04 12:19:18 +02:00
2017-06-19 08:16:42 -05:00
2016-04-04 10:25:29 -05:00
2017-03-22 10:03:45 +01:00
2017-03-22 10:03:45 +01:00
2017-03-22 10:03:45 +01:00