diff options
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r-- | newlib/libc/stdio/findfp.c | 24 | ||||
-rw-r--r-- | newlib/libc/stdio/fseek.c | 8 | ||||
-rw-r--r-- | newlib/libc/stdio/local.h | 8 | ||||
-rw-r--r-- | newlib/libc/stdio/makebuf.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdio/mktemp.c | 6 |
5 files changed, 38 insertions, 12 deletions
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index ac1354619..43f02ba5f 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -52,7 +52,13 @@ _DEFUN(std, (ptr, flags, file, data), ptr->_lbfsize = 0; ptr->_cookie = ptr; ptr->_read = __sread; +#ifndef __LARGE64_FILES ptr->_write = __swrite; +#else /* __LARGE64_FILES */ + ptr->_write = __swrite64; + ptr->_seek64 = __sseek64; + ptr->_flags |= __SL64; +#endif /* __LARGE64_FILES */ ptr->_seek = __sseek; ptr->_close = __sclose; #if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL) @@ -100,7 +106,7 @@ _DEFUN(__sfp, (d), int n; struct _glue *g; - __sfp_lock_acquire (); + __sfp_lock_acquire (); if (!_GLOBAL_REENT->__sdidinit) __sinit (_GLOBAL_REENT); @@ -113,7 +119,7 @@ _DEFUN(__sfp, (d), (g->_next = __sfmoreglue (d, NDYNAMIC)) == NULL) break; } - __sfp_lock_release (); + __sfp_lock_release (); d->_errno = ENOMEM; return NULL; @@ -123,7 +129,7 @@ found: #ifndef __SINGLE_THREAD__ __lock_init_recursive (fp->_lock); #endif - __sfp_lock_release (); + __sfp_lock_release (); fp->_p = NULL; /* no current pointer */ fp->_w = 0; /* nothing to read or write */ @@ -198,7 +204,7 @@ _DEFUN(__sinit, (s), std (s->_stdin, __SRD, 0, s); - /* on platforms that have true file system I/O, we can verify whether stdout + /* on platforms that have true file system I/O, we can verify whether stdout is an interactive terminal or not. For all other platforms, we will default to line buffered mode here. */ #ifdef HAVE_FCNTL @@ -220,25 +226,25 @@ __LOCK_INIT_RECURSIVE(static, __sinit_lock); _VOID _DEFUN_VOID(__sfp_lock_acquire) { - __lock_acquire_recursive (__sfp_lock); + __lock_acquire_recursive (__sfp_lock); } _VOID _DEFUN_VOID(__sfp_lock_release) { - __lock_release_recursive (__sfp_lock); + __lock_release_recursive (__sfp_lock); } _VOID _DEFUN_VOID(__sinit_lock_acquire) { - __lock_acquire_recursive (__sinit_lock); + __lock_acquire_recursive (__sinit_lock); } _VOID _DEFUN_VOID(__sinit_lock_release) { - __lock_release_recursive (__sinit_lock); + __lock_release_recursive (__sinit_lock); } /* Walkable file locking routine. */ @@ -264,7 +270,7 @@ _DEFUN(__fp_unlock, (ptr), _VOID _DEFUN_VOID(__fp_lock_all) { - __sfp_lock_acquire (); + __sfp_lock_acquire (); _CAST_VOID _fwalk (_REENT, __fp_lock); } diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c index 9ba9fac36..e1670e1a1 100644 --- a/newlib/libc/stdio/fseek.c +++ b/newlib/libc/stdio/fseek.c @@ -32,9 +32,9 @@ ANSI_SYNOPSIS #include <stdio.h> int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>) int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>) - int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>, + int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>, long <[offset]>, int <[whence]>) - int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, + int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, off_t <[offset]>, int <[whence]>) TRAD_SYNOPSIS @@ -126,7 +126,11 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence), _fpos_t target; _fpos_t curoff = 0; size_t n; +#ifdef __USE_INTERNAL_STAT64 + struct stat64 st; +#else struct stat st; +#endif int havepos; /* Make sure stdio is set up. */ diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 4263a9de6..0dba774ae 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -46,6 +46,14 @@ extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *))); extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *))); struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); +#ifdef __LARGE64_FILES +extern _fpos64_t _EXFUN(__sseek64,(void *, _fpos64_t, int)); +extern _fpos64_t _EXFUN(__sseek64_r,(struct _reent *, void *, _fpos64_t, int)); +extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(void *, char const *, int)); +extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64_r,(struct _reent *, void *, + char const *, int)); +#endif + /* Called by the main entry point fns to ensure stdio has been initialized. */ #ifdef _REENT_SMALL diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index 340ea28c5..d13f162b2 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -41,7 +41,11 @@ _DEFUN(__smakebuf_r, (ptr, fp), { register size_t size, couldbetty; register _PTR p; +#ifdef __USE_INTERNAL_STAT64 + struct stat64 st; +#else struct stat st; +#endif if (fp->_flags & __SNBF) { diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c index 59e7a5c66..e00228e15 100644 --- a/newlib/libc/stdio/mktemp.c +++ b/newlib/libc/stdio/mktemp.c @@ -60,7 +60,7 @@ TRAD_SYNOPSIS DESCRIPTION <<mktemp>> and <<mkstemp>> attempt to generate a file name that is not -yet in use for any existing file. <<mkstemp>> creates the file and +yet in use for any existing file. <<mkstemp>> creates the file and opens it for reading and writing; <<mktemp>> simply generates the file name. You supply a simple pattern for the generated file name, as the string @@ -108,7 +108,11 @@ _DEFUN(_gettemp, (ptr, path, doopen), register int *doopen) { register char *start, *trv; +#ifdef __USE_INTERNAL_STAT64 + struct stat64 sbuf; +#else struct stat sbuf; +#endif unsigned int pid; pid = _getpid_r (ptr); |