changes of flags and fp lock.
* libc/stdio/freopen.c: Ditto.
* libc/stdio/freopen64.c: Ditto.
* libc/stdio/fgetc.c: Revert change from 2009-04-24, remove sfp locks
which guard entire function to avoid potential deadlocks when using
stdio functions in multiple thraeds.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fgetwc.c: Ditto.
* libc/stdio/fgetws.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getdelim.c: Ditto.
* libc/stdio/gets.c: Ditto.
* libc/stdio/vfscanf.c: Ditto.
* libc/stdio/vfwscanf.c: Ditto.
* libc/stdio/fflush.c (_fflush_r): Split out core functionality into
new function __sflush_r. Just lock file and call __sflush_r from here.
* libc/stdio/fwalk.c (_fwalk): Remove static helper function and move
functionality back into main function. Don't walk a file with flags
value of 1. Add comment.
(_fwalk_reent): Ditto.
* libc/stdio/local.h (__sflush_r): Declare.
* libc/stdio/refill.c (__srefill): Before calling fwalk, set flags
value to 1 so this file pointer isn't walked. Revert flags afterwards
and call __sflush_r for this fp if necessary. Add comments.
* libc/stdio/fgetc.c: Make sure sfp lock is acquired before the
file lock and released before the file lock to avoid a deadlock
scenario.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fgetwc.c: Ditto.
* libc/stdio/fgetws.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getdelim.c: Ditto.
* libc/stdio/gets.c: Ditto.
* libc/include/stdio.h: Add new reentrant I/O prototypes for
read/write functions. Change getc/putc macros to have reentrant underlying
macros/functions. This includes __sgetc_raw_r, __sgetc_r, and __sputc_r.
* libc/stdio/fgetc.c: Fix and/or add reentrant version to call
new reentrant I/O functions/macros for reading/writing.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fputc.c: Ditto.
* libc/stdio/fputs.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio64/fseeko64.c: Ditto.
* libc/stdio/fwrite.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getc_u.c: Ditto.
* libc/stdio/getchar.c: Ditto.
* libc/stdio/getchar_u.c: Ditto.
* libc/stdio/putc.c: Ditto.
* libc/stdio/putc_u.c: Ditto.
* libc/stdio/putchar.c: Ditto.
* libc/stdio/puts.c: Ditto.
* libc/stdio/vfprintf.c: Ditto.
* libc/stdio/vfscanf.c: Ditto.
* libc/stdio/fvwrite.c: Change __sfvwrite into reentrant __sfvwrite_r.
Change all previous callers of __sfvwrite. Set errno to EBADF and
set error flag on if attempt is made to write to file that does not
allow writing.
* libc/stdio/fvwrite.h: Fix new reentrant prototypes.
* libc/stdio/local.h: Ditto.
* libc/stdio/refill.c: Turn __srefill into reentrant __srefill_r.
Set errno to EBADF and the error flag on if attempt is made to
read unreadable file. Change all previous callers of __srefill.
* libc/stdio/rget.c
* libc/stdio/wbuf.c: Turn __swbuf into reentrant __swbuf_r. Change
all previous callers of __swbuf.
* libc/sys/linux/machine/i386/huge_val.h: Ifdef out file contents since
huge value macros are already defined correctly for i386 by <math.h>.