diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-09-03 19:40:36 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-09-03 19:40:36 +0000 |
commit | 3db40db7d83ca924a935680b1c210dd11f1f660d (patch) | |
tree | 23107e83a2372c0eac6bc5831e818d07679240ff /newlib/libc/stdio | |
parent | 20fb0cc51373af49a4f89759ceb16c5933dfb989 (diff) | |
download | cygnal-3db40db7d83ca924a935680b1c210dd11f1f660d.tar.gz cygnal-3db40db7d83ca924a935680b1c210dd11f1f660d.tar.bz2 cygnal-3db40db7d83ca924a935680b1c210dd11f1f660d.zip |
2002-09-03 Jeff Johnston <jjohnstn@redhat.com>
* 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>.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r-- | newlib/libc/stdio/findfp.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdio/fopen.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index a42a69206..4f1387ccb 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -22,6 +22,7 @@ #include <errno.h> #include <string.h> #include <fcntl.h> +#include <sys/lock.h> #include "local.h" static void @@ -45,6 +46,9 @@ std (ptr, flags, file, data) ptr->_seek = __sseek; ptr->_close = __sclose; ptr->_data = data; +#ifndef __SINGLE_THREAD__ + __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&ptr->_lock); +#endif #ifdef __SCLE if (__stextmode(ptr->_file)) diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index e4708785d..ff2cbec46 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -119,6 +119,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifdef __CYGWIN__ #include <fcntl.h> #endif +#include <sys/lock.h> FILE * _DEFUN (_fopen_r, (ptr, file, mode), @@ -157,6 +158,10 @@ _DEFUN (_fopen_r, (ptr, file, mode), fp->_flags |= __SCLE; #endif +#ifndef __SINGLE_THREAD__ + __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock); +#endif + return fp; } |