Question for Thomas Pfaff regarding stdio and threads

Christopher Faylor cgf@redhat.com
Mon Jan 26 19:17:00 GMT 2004


I discovered something today regarding the never-ending saga of getting
stdio working correctly in threads.

I found that I needed to initialize the local_clib.__sglue._niobs and
local_clib.__sglue._iobs fields in the thread's local_clib structure or
the count of open handles was set incorrectly and _fwalk (which is used
by setmode) did not operate correctly.  __sinit in
~newlib/libc/stdio/findfp.c does this, so we have to mimic it, too.

The problem is that every thread will have its own copy of _niobs and
_siobs could, I assume, be reallocated.  That's not good for threads
which call fopen.

This seems like a complete mess, and I don't know how to proceed.  It
seems, once again, like a redesign of newlib is called for, which is
certainly not something that I want to do.  It is, however, causing the
1.5.7 release to stall.  The current behavior causes setmode to be
inoperable so things which use it, like bzip2 and gzip will operate
badly on text mode mounts.

So, my question is:  Do you have any ideas on what to do here?  I'm
rather stumped.

I'm ccing you since I see that you've unsubscribed from
cygwin-developers.  I hope you don't mind this question even though
you've officially stepped down from maintainership.

cgf



More information about the Cygwin-developers mailing list