newlib-cygwin/newlib/libc/include
Sebastian Huber b0cb9f85ca Use global stdio streams for all configurations
The _REENT_GLOBAL_STDIO_STREAMS was introduced by commit
668a4c8722 in 2017.  Since then it was enabled by
default for RTEMS.  Recently, the option was enabled for Cygwin which
previously used an alternative implementation to use global stdio streams.

In Newlib, the stdio streams are defined to thread-specific pointers
_reent::_stdin, _reent::_stdout and _reent::_stderr.  If the option is disabled
(the default for most systems), then these pointers are initialized to
thread-specific FILE objects which use file descriptors 0, 1, and 2,
respectively.  There are at least three problems with this:

(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 (for example 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().

(3) There are resource managment issues, see:

    https://sourceware.org/pipermail/newlib/2022/019558.html

    https://bugs.linaro.org/show_bug.cgi?id=5841

This patch enables the _REENT_GLOBAL_STDIO_STREAMS behaviour for all Newlib
configurations and removes the option.  This removes a couple of #ifdef blocks.
2022-06-10 20:13:52 +02:00
..
machine Revert "sys/types.h: Don't include sys/_stdint.h" 2022-05-04 15:08:44 +02:00
rpc ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ssp ssp: fix wchar.h with -std=c99 2018-03-14 10:46:32 -05:00
sys Use global stdio streams for all configurations 2022-06-10 20:13:52 +02:00
_ansi.h ansification: remove _HAVE_STDC 2018-01-17 11:47:30 -06:00
_newlib_version.h Fix _newlib_version.h logic to support building gcc with newlib. 2016-02-25 15:04:19 -05:00
_syslist.h
alloca.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ar.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
argz.h
assert.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
complex.h Fixed warnings for some long double complex methods 2017-07-05 14:40:02 +02:00
cpio.h Add cpio.h 2016-04-04 10:25:27 -05:00
ctype.h Revert "ctype: use less short names in public header" 2021-12-03 10:50:58 +01:00
devctl.h libc/include/newlib.h: Fix C++ compilation issue 2020-11-16 08:15:18 -06:00
dirent.h change _COMPILING_NEWLIB to _LIBC 2021-11-15 19:32:23 -05:00
elf.h Add the Aarch64 SVE specific HWCAP_SVE define 2017-11-22 14:10:37 -05:00
envlock.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
envz.h
errno.h
fastmath.h
fcntl.h
fenv.h Add default implementation of fenv.h and all methods 2019-08-09 17:49:16 +02:00
fnmatch.h Feature test macros overhaul: fnmatch.h 2016-03-17 21:08:54 -05:00
ftw.h FTW Port for Newlib 2021-02-09 11:07:59 +01:00
getopt.h newlib: getopt now permutes multi-flag options correctly 2018-06-18 18:45:44 +02:00
glob.h 2013-11-21 Julio Gutierrez <jgutleyva@gmail.com> 2013-11-21 17:04:57 +00:00
grp.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
iconv.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
ieeefp.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
inttypes.h inttypes.h: Use reserved names for function parameters 2021-06-25 16:48:31 -04:00
langinfo.h Rename <xlocale.h> back to <sys/_locale.h> 2019-06-14 10:02:08 +02:00
libgen.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
limits.h Include sys/syslimits.h in limits.h 2018-09-06 14:11:45 +02:00
locale.h change _COMPILING_NEWLIB to _LIBC 2021-11-15 19:32:23 -05:00
malloc.h Add prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this from nano-mallocr.c 2018-02-16 12:16:07 +01:00
math.h Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2 2022-04-11 12:00:16 -04:00
memory.h Provide <memory.h> 2016-11-22 14:21:35 +01:00
ndbm.h Fix ndbm.c build break 2022-05-04 13:08:10 -04:00
newlib.h
paths.h 2013-10-10 Sebastian Huber <sebastian.huber@embedded-brains.de> 2013-10-15 17:34:23 +00:00
pthread.h libc: Added prototypes for new POSIX APIs 2021-08-09 10:29:55 +02:00
pwd.h Cygwin: simplify some function names 2022-05-29 17:45:52 -04:00
reent.h change _COMPILING_NEWLIB to _LIBC 2021-11-15 19:32:23 -05:00
regdef.h
regex.h 2013-11-20 Chirayu Desai <chirayudesai1@gmail.com> 2013-11-20 16:25:50 +00:00
sched.h sched.h: Declare affinity functions only on targets supporting them 2019-08-12 17:30:20 +02:00
search.h 2013-11-20 Daniel Ramirez <javamonn@gmail.com> 2013-11-20 18:22:27 +00:00
setjmp.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
signal.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
spawn.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
stdatomic.h sys: clean up empty lines in .c and .h files 2020-10-26 14:18:46 +01:00
stdint.h Provide __intmax_t and __uintmax_t 2016-10-25 16:24:05 +02:00
stdio.h In <stdio.h> provide only necessary types 2022-05-04 15:08:53 +02:00
stdio_ext.h ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
stdlib.h Rename <xlocale.h> back to <sys/_locale.h> 2019-06-14 10:02:08 +02:00
string.h Unconditionally declare strsignal 2021-10-27 20:02:06 +02:00
strings.h Rename <xlocale.h> back to <sys/_locale.h> 2019-06-14 10:02:08 +02:00
tar.h Feature test macros overhaul: tar.h 2016-04-04 10:25:29 -05:00
termios.h
tgmath.h Add missing long double functions to Cygwin 2016-03-29 14:43:55 +02:00
threads.h Import <threads.h> from latest FreeBSD. 2015-10-13 17:52:34 -04:00
time.h libc/time: Move internal newlib tz-structs into own header 2020-10-15 16:59:51 +02:00
unctrl.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
unistd.h
utime.h
utmp.h
wchar.h libc/include/wchar.h: Remove parameter name 2020-10-02 17:02:28 -04:00
wctype.h Rename <xlocale.h> back to <sys/_locale.h> 2019-06-14 10:02:08 +02:00
wordexp.h 2013-11-23 Bryan Dunsmore <dunsmoreb@gmail.com> 2013-11-23 22:39:34 +00:00