newlib-cygwin/newlib/libc
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
..
argz Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
ctype Bump release to 2.5.0 for yearly snapshot. 2016-12-22 21:33:54 -05:00
errno Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
iconv Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
include Introduce _REENT_GLOBAL_STDIO_STREAMS 2017-06-30 07:45:16 +02:00
locale Fix duplocale (libc/locale/duplocale.c) which fails to properly call __loadlocale 2017-03-13 11:12:01 +01:00
machine Optimized memcmp 2017-06-29 20:36:35 +02:00
misc Allow locking routine to be retargeted 2017-02-13 17:07:11 -05:00
posix Only define static locks in multithreaded mode 2017-02-13 17:04:17 -05:00
reent Revert "Fix __getreent function for Cygwin" 2016-08-18 15:24:18 +02:00
search Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
signal Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
stdio Introduce _REENT_GLOBAL_STDIO_STREAMS 2017-06-30 07:45:16 +02:00
stdio64 Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
stdlib Add BSD-specific reallocarray() 2017-04-04 12:19:18 +02:00
string string: fix strverscmp doc inclusion 2017-06-19 11:52:02 -05:00
sys Remove FreeBSD specifics from RTEMS <arpa/inet.h> 2017-06-12 08:41:24 +02:00
syscalls Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
time Unify names of all lock objects 2017-02-06 16:55:09 -05:00
unix Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
xdr Regenerate newlib Makefiles 2016-07-04 17:13:55 +01:00
Makefile.am Make newlib manpages (v3) 2016-07-04 14:17:10 +01:00
Makefile.in Bump release to 2.5.0 for yearly snapshot. 2016-12-22 21:33:54 -05:00
aclocal.m4 Fix up errors in regenerated files for 2.3.0 release. 2016-01-04 12:57:31 -05:00
configure Allow locking routine to be retargeted 2017-02-13 17:07:11 -05:00
configure.in Allow locking routine to be retargeted 2017-02-13 17:07:11 -05:00
libc.in.xml Make newlib manpages (v3) 2016-07-04 14:17:10 +01:00
libc.texinfo Fix versions in documentation (manually for now) 2017-01-09 16:22:02 +01:00
saber
sys.tex Don't include stdio64 functions in reentrant syscalls menu when not bulding stdio64. 2015-08-03 09:54:33 +01:00