* libc/include/sys/_types.h (_flock_t): Added.
* libc/include/sys/lock.h (__lock_try_acquire): New interface.
(__lock_try_acquire_recursive): Ditto.
* libc/include/sys/reent.h (__sFILE, __sFILE64): Add new
_lock field.
* libc/stdio/findfp.c (std)[!__SINGLE_THREAD__]: Initialize _lock
field.
* libc/stdio/fopen.c (_fopen_r)[!__SINGLE_THREAD__]: Ditto.
* libc/stdio64/fopen64.c (_fopen64_r)[!__SINGLE_THREAD__]: Ditto.
* libc/sys/linux/include/time.h (struct timespec): Moved from
<sys/types.h> and added check for __need_timespec flag so type
can be defined by itself.
* libc/sys/linux/sys/_types.h (_flock_t): New type.
* libc/sys/linux/sys/types.h (struct timespec): Moved to
<time.h>.
(__sread): always read in binary mode
(__swrite): always write in binary mode
* libc/include/stdio.h: no getc/putc macros for cygwin; causes
compatibility issues with different dll versions
* libc/stdio/fopen.c: use __stextmode
* libc/stdio/fdopen.c: ditto
* libc/stdio/freopen.c: ditto
* libc/stdio/findfp.c: set up __SCLE for std{in,out,err}
* libc/stdio/local.h: declare __stextmode
* libc/include/stdio.h (FILE): define __SCLE for "convert line
endings" for Cygwin.
(__sgetc): convert line endings if needed
(__sputc): ditto
* libc/stdio/fdopen.c (_fdopen_r): Remember if we opened in text mode
* libc/stdio/fopen.c (_fopen_r): ditto
* libc/stdio/freopen.c (freopen): ditto
* libc/stdio/fread.c (fread): perform CRLF conversions if __SCLE
* libc/stdio/fvwrite.c (__sfvwrite): ditto