* libc/include/sys/stdio.h: New file.

* libc/sys/linux/sys/stdio.h: New file.
	* libc/include/stdio.h: Add declarations for flockfile,
	ftrylockfile, and funlockfile.  Include <sys/stdio.h>.
	* libc/stdio/clearerr.c: Add file locking.
	* libc/stdio/fclose.c: Likewise.
	* libc/stdio/feof.c: Likewise.
	* libc/stdio/ferror.c: Likewise.
	* libc/stdio/fflush.c: Likewise.
	* libc/stdio/fgetc.c: Likewise.
	* libc/stdio/fgetpos.c: Likewise.
	* libc/stdio/fgets.c: Likewise.
	* libc/stdio/fileno.c: Likewise.
	* libc/stdio/fputc.c: Likewise.
	* libc/stdio/fputs.c: Likewise.
	* libc/stdio/fread.c: Likewise.
	* libc/stdio/freopen.c: Likewise.
	* libc/stdio/fseek.c: Likewise.
	* libc/stdio/ftell.c: Likewise.
	* libc/stdio/fwrite.c: Likewise.
	* libc/stdio/getc.c: Likewise.
	* libc/stdio/putc.c: Likewise.
	* libc/stdio/setvbuf.c: Likewise.
	* libc/stdio/ungetc.c: Likewise.
	* libc/stdio/vfprintf.c: Likewise.
This commit is contained in:
Thomas Fitzsimmons
2002-05-08 00:12:49 +00:00
parent 735bb7e7d7
commit e71372faea
25 changed files with 222 additions and 35 deletions

View File

@ -76,12 +76,15 @@ _DEFUN (freopen, (file, mode, fp),
int flags, oflags, e;
struct _reent *ptr;
_flockfile(fp);
CHECK_INIT (fp);
ptr = fp->_data;
if ((flags = __sflags (ptr, mode, &oflags)) == 0)
{
(void) fclose (fp);
_funlockfile(fp);
return NULL;
}
@ -137,6 +140,7 @@ _DEFUN (freopen, (file, mode, fp),
{ /* did not get it after all */
fp->_flags = 0; /* set it free */
ptr->_errno = e; /* restore in case _close clobbered */
_funlockfile(fp);
return NULL;
}
@ -153,5 +157,6 @@ _DEFUN (freopen, (file, mode, fp),
fp->_flags |= __SCLE;
#endif
_funlockfile(fp);
return fp;
}