This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [pa3efu@yahoo.com: Re: setvbuf/setlinebuf issue] Thomas canyou comment?


Corinna Vinschen wrote:
On Fri, Sep 19, 2003 at 08:11:10AM +0200, Thomas Pfaff wrote:

This is another problem with __DYNAMIC_REENT__, where every thread has its own stdin, stdout and stderr FIL pointer.

I already submitted a patch to newlib which should hopefully fix this. After its acceptance it requires 3 additional functions to be exported in cygwin.din.

The bad news are that this patch again needs a recompilation of all user apps, starting with gcc to get it into libstdc++, because the stdin, stdout and stderr defines have changed again.


Is it backward compatible, though? Will old apps still work?


All apps will still work.


In short terms the patch will revert stdin, -out and -err back to _impure_ptr instead of the thread local reent. These defines were also used by older apps previour to the __DYNAMIC_REENT__change.

This affects only multithreaded apps and of course the libs they are using that were compiled in the meantime, and they will continue to work, but the bug will remain until recompilation.

The reason for this is the stdio header:

#ifndef _REENT_ONLY
#define	stdin	(_REENT->_stdin)
#define	stdout	(_REENT->_stdout)
#define	stderr	(_REENT->_stderr)
#else /* _REENT_ONLY */
#define	stdin	(_impure_ptr->_stdin)
#define	stdout	(_impure_ptr->_stdout)
#define	stderr	(_impure_ptr->_stderr)
#endif /* _REENT_ONLY */

To avoid this in the future (if it will be accepted in newlib) i have changed the defines to

extern  __FILE **__stdin _PARAMS ((void));
extern  __FILE **__stdout _PARAMS ((void));
extern  __FILE **__stderr _PARAMS ((void));
#define stdin (*__stdin())
#define stdout (*__stdout())
#define stderr (*__stderr())

which will allow to make changes without recompiling everything.

Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]