[PATCH] Fix stdin,-out and -err for multithreaded apps
Christopher Faylor
cgf@redhat.com
Thu Sep 25 09:12:00 GMT 2003
On Thu, Sep 18, 2003 at 09:05:26PM +0200, Thomas Pfaff wrote:
>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.
You really can't redefine stdin, stdout, and stderr as functions.
That will break static initialization.
Can't you just change the initializers in REENT_INIT and REENT_INIT_PTR
to point the reent _std* variables at _impure_ptr->_std* instead?
That means there is some wasted storage in _reent but that's not a
big deal.
cgf
More information about the Newlib
mailing list