Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/fopen.c')
-rw-r--r--newlib/libc/stdio/fopen.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c
index 64c24e7ef..bcd2287c5 100644
--- a/newlib/libc/stdio/fopen.c
+++ b/newlib/libc/stdio/fopen.c
@@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
FILE *fopen(const char *<[file]>, const char *<[mode]>);
- FILE *_fopen_r(struct _reent *<[reent]>,
+ FILE *_fopen_r(void *<[reent]>,
const char *<[file]>, const char *<[mode]>);
TRAD_SYNOPSIS
@@ -38,7 +38,7 @@ TRAD_SYNOPSIS
char *<[mode]>;
FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[file]>;
char *<[mode]>;
@@ -113,21 +113,19 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/lock.h>
+#include "local.h"
#ifdef __CYGWIN__
#include <fcntl.h>
#endif
-#include "local.h"
+#include <sys/lock.h>
FILE *
-_DEFUN(_fopen_r, (ptr, file, mode),
- struct _reent *ptr _AND
- _CONST char *file _AND
- _CONST char *mode)
+_DEFUN (_fopen_r, (ptr, file, mode),
+ struct _reent *ptr _AND
+ _CONST char *file _AND
+ _CONST char *mode)
{
register FILE *fp;
register int f;
@@ -140,17 +138,10 @@ _DEFUN(_fopen_r, (ptr, file, mode),
if ((f = _open_r (ptr, file, oflags, 0666)) < 0)
{
- __sfp_lock_acquire ();
fp->_flags = 0; /* release */
-#ifndef __SINGLE_THREAD__
- __lock_close_recursive (fp->_lock);
-#endif
- __sfp_lock_release ();
return NULL;
}
- _flockfile (fp);
-
fp->_file = f;
fp->_flags = flags;
fp->_cookie = (_PTR) fp;
@@ -167,16 +158,19 @@ _DEFUN(_fopen_r, (ptr, file, mode),
fp->_flags |= __SCLE;
#endif
- _funlockfile (fp);
+#ifndef __SINGLE_THREAD__
+ __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
+#endif
+
return fp;
}
#ifndef _REENT_ONLY
FILE *
-_DEFUN(fopen, (file, mode),
- _CONST char *file _AND
- _CONST char *mode)
+_DEFUN (fopen, (file, mode),
+ _CONST char *file _AND
+ _CONST char *mode)
{
return _fopen_r (_REENT, file, mode);
}