This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [PATCH] _fwalk walks through thread local FILE pointer
- From: Joel Sherrill <joel dot sherrill at OARcorp dot com>
- To: Thomas Pfaff <tpfaff at gmx dot net>
- Cc: newlib at sources dot redhat dot com
- Date: Thu, 29 Jan 2004 08:22:47 -0600
- Subject: Re: [PATCH] _fwalk walks through thread local FILE pointer
- Organization: OAR Corporation
- References: <40180AAB.9030405@gmx.net>
This isn't right. You are passed a REENT pointer and cannot
simply ignore it.
This will break any code that depends upon the existing
behavior. In RTEMS, we use _fwalk as it exists to
implement sync() and walk each thread's open files.
It is also used as part of the per-thread cleanup
dynamically.
If you want to have NULL ptr argument imply the global
reent, great but don't break it.
--joel
Thomas Pfaff wrote:
instead of global file pointer list.
Thomas
2004-01-28 Thomas Pfaff <tpfaff.gmx.net>
* libc/stdio/fwalk.c (_fwalk): Walk through global file
pointer list instead of thread lokal.
------------------------------------------------------------------------
--- fwalk.c.org 2000-05-14 18:46:11.000000000 +0200
+++ fwalk.c 2004-01-28 10:01:03.646001600 +0100
@@ -35,7 +35,7 @@ _fwalk (ptr, function)
register int n, ret = 0;
register struct _glue *g;
- for (g = &ptr->__sglue; g != NULL; g = g->_next)
+ for (g = &_GLOBAL_REENT->__sglue; g != NULL; g = g->_next)
for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
if (fp->_flags != 0)
ret |= (*function) (fp);