[PATCH] _fwalk walks through thread local FILE pointer

Joel Sherrill joel.sherrill@OARcorp.com
Thu Jan 29 14:45:00 GMT 2004


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);




More information about the Newlib mailing list