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>.
This commit is contained in:
@ -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))
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user