From 0eca075074ec5463cf9b5a0ebe52073886cb5b89 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 26 Aug 2003 18:09:43 +0000 Subject: [PATCH] 2003-08-26 Jeff Johnston * libc/include/stdio.h: Allow the io64 function prototypes for Cygwin when compiling newlib. * libc/include/sys/stat.h[__CYGWIN__]: Define stat64 as __stat64 to expose the Cygwin struct __stat64 type. * libc/stdio64/fseeko64.c: Use _fstat64_r and pass a struct stat64 pointer. * libc/stdio64/tmpfile64.c(_tmpfile64_r): Call _fopen64_r. --- newlib/ChangeLog | 10 ++++++++++ newlib/libc/include/stdio.h | 2 +- newlib/libc/include/sys/stat.h | 1 + newlib/libc/stdio64/fseeko64.c | 5 ++--- newlib/libc/stdio64/tmpfile64.c | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index ee34c8b8c..b089e12d6 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,13 @@ +2003-08-26 Jeff Johnston + + * libc/include/stdio.h: Allow the io64 function prototypes for + Cygwin when compiling newlib. + * libc/include/sys/stat.h[__CYGWIN__]: Define stat64 as __stat64 + to expose the Cygwin struct __stat64 type. + * libc/stdio64/fseeko64.c: Use _fstat64_r and pass a struct stat64 + pointer. + * libc/stdio64/tmpfile64.c(_tmpfile64_r): Call _fopen64_r. + 2003-08-23 Christopher Faylor * libc/stdio64/fseeko64.c (fseeko64_r): Rename second fseeko64_r diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 5f22dfc1b..f1ee3ee4f 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -308,7 +308,7 @@ ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *)); ssize_t _EXFUN(__getline, (char **, size_t *, FILE *)); #ifdef __LARGE64_FILES -#ifndef __CYGWIN__ +#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB) FILE * _EXFUN(fdopen64, (int, const char *)); FILE * _EXFUN(fopen64, (const char *, const char *)); _off64_t _EXFUN(ftello64, (FILE *)); diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index 5fd75e2be..0bd951ac2 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -24,6 +24,7 @@ extern "C" { #ifdef __CYGWIN__ #include +#define stat64 __stat64 #else struct stat { diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 524aac32e..312883072 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -108,8 +108,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence), _fpos64_t target, curoff; size_t n; - /* FIXME: this should be stat64. */ - struct stat st; + struct stat64 st; int havepos; _flockfile(fp); @@ -205,7 +204,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence), { if (seekfn != __sseek64 || fp->_file < 0 - || _fstat_r (ptr, fp->_file, &st) + || _fstat64_r (ptr, fp->_file, &st) || (st.st_mode & S_IFMT) != S_IFREG) { fp->_flags |= __SNPT; diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c index 1f97c071c..98689631f 100644 --- a/newlib/libc/stdio64/tmpfile64.c +++ b/newlib/libc/stdio64/tmpfile64.c @@ -63,9 +63,9 @@ _DEFUN (_tmpfile64_r, (ptr), if ((f = _tmpnam_r (ptr, buf)) == NULL) return NULL; - fp = fopen64 (f, "wb+"); + fp = _fopen64_r (ptr, (const char *)f, "wb+"); e = ptr->_errno; - _CAST_VOID remove (f); + _CAST_VOID _remove_r (ptr, f); ptr->_errno = e; return fp; }