[PATCH] Fix stdin,-out and -err for multithreaded apps

Thomas Pfaff tpfaff@gmx.net
Tue Sep 23 07:09:00 GMT 2003


Attached is a patch that should fix the bug reported at

http://sources.redhat.com/ml/newlib/2003/msg00544.html.

which is another __DYNAMIC_REENT related problem.

It will change stdin, -out and -err locations to use _GLOBAL_REENT 
instead of _REENT where appropriate, and it includes a change for the 
stdin, stdout and stderr defines that i suggested some time ago (see 
http://sources.redhat.com/ml/newlib/2003/msg00363.html).
This will allow to change stdin, stdout and stderr without recompiling 
all user apps in the future.

If speed is an issue the former defines can be used by defining 
_INLINE_STDFP.

After applying this patch Makefile.in must be regenerated.

Comments are welcome.

TIA,
Thomas

2003-09-18  Thomas Pfaff  <tpfaff@gmx.net>

	* libc/include/stdio.h: Redefine stdin, stdout and stderr to use
	function calls instead of direct member access if newlib is
	compiled without _INLINE_STDFP.
	* libc/stdio/Makefile.am (GENERAL_SOURCES): Add stdfp.c.
	* libc/stdio/stdfp.c: New file.
	* libc/stdio/getchar.c: Replace _REENT with _GLOBAL_REENT where
	appropriate.
	* libc/stdio/getchar_u.c: Ditto.
	* libc/stdio/gets.c: Ditto.
	* libc/stdio/iprintf.c: Ditto.
	* libc/stdio/perror.c: Ditto.
	* libc/stdio/printf.c: Ditto.
	* libc/stdio/putchar.c: Ditto.
	* libc/stdio/putchar_u.c: Ditto.
	* libc/stdio/puts.c: Ditto.
	* libc/stdio/scanf.c: Ditto.
	* libc/stdio/vprintf.c: Ditto.
	* libc/stdio/vscanf.c: Ditto.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib-stdio.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20030923/891622d9/attachment.ksh>


More information about the Newlib mailing list