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:
authorJeff Johnston <jjohnstn@redhat.com>2002-07-18 03:25:44 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-07-18 03:25:44 +0400
commitdee51391315e2bb819409a6b3eb23ee6ef6d3c59 (patch)
tree17c5dc4dd302a05142ab357c745e37305c6b04ea /newlib/libc/include
parent30a431abf19a11923e53050fc94619e8705d4e50 (diff)
2002-07-17 Jeff Johnston <jjohnstn@redhat.com>
* configure.host(stdio64_dir): New setting that is used to enable building of new stdio64 directory. * libc/Makefile.am[HAVE_STDIO64_DIR]: Add support for large files. (stmp-stdio64,stdio64.texi): New targets to optionally add in stdio64 info to info files. * libc/Makefile.in: Regenerated. * libc/configure: Ditto. * libc/configure.in: Add configuration variables that are set when stdio64 is selected as subdir in configure.host. * libc/libc.texinfo: Add optional menu item for Stdio64, based on whether STDIO64 flag is set or not. * libc/sys.tex: Add optional stdio64 syscalls based on whether STDIO64 flag is set or not. * libc/include/reent.h[__LARGE64_FILES]: Add new stdio64 _r sycall routines. * libc/include/stdio.h[__LARGE64_FILES]: Add new stdio64 prototypes. (FILE): Typedef'd to __FILE instead of struct __sFILE directly. (__SL64): New file flag indicating file is opened via fopen64. * libc/include/sys/_types.h(_off64_t): Added. * libc/include/sys/config.h: For x86-linux, define __LARGE64_FILES. * libc/include/sys/reent.h(struct __sFILE64): New file structure for 64-bit offset large file support. (__FILE): New intermediate type either set to struct __sFILE64 or struct __sFILE, depending on whether __LARGE64_FILES is set or not. * libc/reent/Makefile.am[HAVE_STDIO64_DIR]: Add new files. * libc/reent/Makefile.in: Regenerated. * libc/reent/fstat64r.c: New file. * libc/reent/lseek64r.c: Ditto. * libc/reent/open64r.c: Ditto. * libc/reent/reent.tex: Optionally add stdio64 reentrant syscalls based on whether STDIO64 flag is set. * libc/stdio/stdio.tex: Add blank line. * libc/stdio64/Makefile.am: New file. * libc/stdio64/Makefile.in: Ditto. * libc/stdio64/fgetpos64.c: Ditto. * libc/stdio64/fopen64.: Ditto. * libc/stdio64/freopen64.c: Ditto. * libc/stdio64/fseeko64.c: Ditto. * libc/stdio64/fsetpos64.c: Ditto. * libc/stdio64/ftello64.c: Ditto. * libc/stdio64/local64.h: Ditto. * libc/stdio64/stdio64.c: Ditto. * libc/stdio64/stdio64.tex: Ditto. * libc/stdio64/tmpfile64.c: Ditto. * libc/sys/linux/io64.c: Add weak aliases for lseek64, fstat64, and open64.
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/reent.h8
-rw-r--r--newlib/libc/include/stdio.h27
-rw-r--r--newlib/libc/include/sys/_types.h1
-rw-r--r--newlib/libc/include/sys/config.h1
-rw-r--r--newlib/libc/include/sys/reent.h91
5 files changed, 105 insertions, 23 deletions
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index 56fae91a4..b54e4cbb8 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -81,6 +81,14 @@ extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t));
/* This one is not guaranteed to be available on all targets. */
extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *tp, struct timezone *tzp));
+#ifdef __LARGE64_FILES
+struct stat64;
+
+extern _off64_t _lseek64_r _PARAMS ((struct _reent *, int, _off64_t, int));
+extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *));
+extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int));
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 1cc83ab01..9e93ed5bc 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -37,7 +37,7 @@
#include <stdarg.h>
/*
- * <sys/reent.h> defines __sFILE, _fpos_t.
+ * <sys/reent.h> defines __FILE, _fpos_t.
* They must be defined there because struct _reent needs them (and we don't
* want reent.h to include this file.
*/
@@ -48,7 +48,11 @@
_BEGIN_STD_C
typedef _fpos_t fpos_t;
-typedef struct __sFILE FILE;
+typedef __FILE FILE;
+
+#ifdef __LARGE64_FILES
+typedef _fpos64_t fpos64_t;
+#endif
#include <sys/stdio.h>
@@ -68,8 +72,9 @@ typedef struct __sFILE FILE;
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
#define __SMOD 0x2000 /* true => fgetline modified _p text */
#if defined(__CYGWIN__) || defined(__CYGWIN__)
-#define __SCLE 0x4000 /* convert line endings CR/LF <-> NL */
+# define __SCLE 0x4000 /* convert line endings CR/LF <-> NL */
#endif
+#define __SL64 0x8000 /* is 64-bit offset large file */
/*
* The following three definitions are for ANSI C, which took them
@@ -279,6 +284,22 @@ int _EXFUN(_vsscanf_r, (struct _reent *, const char *, const char *, __VALIST));
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
+#ifdef __LARGE64_FILES
+FILE * _EXFUN(fopen64, (const char *, const char *));
+_off64_t _EXFUN(ftello64, (FILE *));
+_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
+int _EXFUN(fgetpos64, (FILE *, _fpos64_t *));
+int _EXFUN(fsetpos64, (FILE *, const _fpos64_t *));
+FILE * _EXFUN(tmpfile64, (void));
+
+FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *));
+_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *));
+_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int));
+int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
+int _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
+FILE * _EXFUN(_tmpfile64_r, (struct _reent *));
+#endif /* __LARGE64_FILES */
+
/*
* Routines internal to the implementation.
*/
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index a2f6e3929..a487676bc 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -10,6 +10,7 @@
#define _SYS__TYPES_H
typedef long _off_t;
+__extension__ typedef long long _off64_t;
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index e12e800f5..e49238d3a 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -48,6 +48,7 @@
#define HAVE_GETDATE
#define _HAVE_SYSTYPES
#define _READ_WRITE_RETURN_TYPE _ssize_t
+#define __LARGE64_FILES 1
#endif
#endif
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index f75684cdf..4b570cee7 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -23,8 +23,11 @@ typedef unsigned __Long __ULong;
#endif
#endif
-#ifndef __Long
+#if !defined( __Long)
#include <sys/types.h>
+#endif
+
+#ifndef __Long
#define __Long __int32_t
typedef __uint32_t __ULong;
#endif
@@ -34,13 +37,6 @@ typedef __uint32_t __ULong;
* by having nearly everything possible allocated at first use.
*/
-struct _glue
-{
- struct _glue *_next;
- int _niobs;
- struct __sFILE *_iobs;
-};
-
struct _Bigint
{
struct _Bigint *_next;
@@ -88,7 +84,7 @@ struct _atexit {
/*
* Stdio buffers.
*
- * This and __sFILE are defined here because we need them for struct _reent,
+ * This and __FILE are defined here because we need them for struct _reent,
* but we don't want stdio.h included when stdlib.h is.
*/
@@ -105,6 +101,10 @@ struct __sbuf {
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
/* (and must be `long' for now) */
+#ifdef __LARGE64_FILES
+typedef _off64_t _fpos64_t;
+#endif
+
/*
* Stdio state variables.
*
@@ -196,6 +196,57 @@ struct __sFILE {
#endif
};
+#ifdef __LARGE64_FILES
+struct __sFILE64 {
+ unsigned char *_p; /* current position in (some) buffer */
+ int _r; /* read space left for getc() */
+ int _w; /* write space left for putc() */
+ short _flags; /* flags, below; this FILE is free if 0 */
+ short _file; /* fileno, if Unix descriptor, else -1 */
+ struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
+ int _lbfsize; /* 0 or -_bf._size, for inline putc */
+
+ struct _reent *_data;
+
+ /* operations */
+ _PTR _cookie; /* cookie passed to io functions */
+
+ _READ_WRITE_RETURN_TYPE _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n));
+ _READ_WRITE_RETURN_TYPE _EXFUN((*_write),(_PTR _cookie, const char *_buf,
+ int _n));
+ _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence));
+ int _EXFUN((*_close),(_PTR _cookie));
+
+ /* separate buffer for long sequences of ungetc() */
+ struct __sbuf _ub; /* ungetc buffer */
+ unsigned char *_up; /* saved _p when _p is doing ungetc data */
+ int _ur; /* saved _r when _r is counting ungetc data */
+
+ /* tricks to meet minimum requirements even when malloc() fails */
+ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
+ unsigned char _nbuf[1]; /* guarantee a getc() buffer */
+
+ /* separate buffer for fgetline() when line crosses buffer boundary */
+ struct __sbuf _lb; /* buffer for fgetline() */
+
+ /* Unix stdio files get aligned to block boundaries on fseek() */
+ int _blksize; /* stat.st_blksize (may be != _bf._size) */
+ int _flags2; /* for future use */
+ _off64_t _offset; /* current lseek offset */
+ _fpos64_t _EXFUN((*_seek64),(_PTR _cookie, _fpos64_t _offset, int _whence));
+};
+typedef struct __sFILE64 __FILE;
+#else
+typedef struct __sFILE __FILE;
+#endif /* __LARGE64_FILES */
+
+struct _glue
+{
+ struct _glue *_next;
+ int _niobs;
+ __FILE *_iobs;
+};
+
/*
* rand48 family support
*
@@ -271,7 +322,7 @@ struct _reent
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
- struct __sFILE *_stdin, *_stdout, *_stderr; /* XXX */
+ __FILE *_stdin, *_stdout, *_stderr; /* XXX */
int _errno; /* local copy of errno */
@@ -305,22 +356,22 @@ struct _reent
struct _atexit _atexit;
struct _glue __sglue; /* root of glue chain */
- struct __sFILE *__sf; /* file descriptors */
+ __FILE *__sf; /* file descriptors */
struct __sFILE_fake __sf_fake; /* fake initial stdin/out/err */
struct _misc_reent *_misc; /* strtok, multibyte states */
char *_signal_buf; /* strsignal */
};
#define _REENT_INIT(var) \
- { (struct __sFILE *)&var.__sf_fake, (struct __sFILE *)&var.__sf_fake, \
- (struct __sFILE *)&var.__sf_fake, 0, 0, _NULL, 0, 0, \
+ { (__FILE *)&var.__sf_fake, (__FILE *)&var.__sf_fake, \
+ (__FILE *)&var.__sf_fake, 0, 0, _NULL, 0, 0, \
"C", _NULL, _NULL, 0, 0, _NULL, _NULL, _NULL, _NULL, _NULL, \
{ 0, _NULL, _NULL, 0 }, { _NULL, 0, _NULL }, _NULL, 0, _NULL, _NULL }
#define _REENT_INIT_PTR(var) \
- { var->_stdin = (struct __sFILE *)&var->__sf_fake; \
- var->_stdout = (struct __sFILE *)&var->__sf_fake; \
- var->_stderr = (struct __sFILE *)&var->__sf_fake; \
+ { var->_stdin = (__FILE *)&var->__sf_fake; \
+ var->_stdout = (__FILE *)&var->__sf_fake; \
+ var->_stderr = (__FILE *)&var->__sf_fake; \
var->_errno = 0; \
var->_inc = 0; \
var->_emergency = _NULL; \
@@ -453,7 +504,7 @@ struct _reent
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
- struct __sFILE *_stdin, *_stdout, *_stderr;
+ __FILE *_stdin, *_stdout, *_stderr;
int _inc; /* used by tmpnam */
char _emergency[_REENT_EMERGENCY_SIZE];
@@ -511,11 +562,11 @@ struct _reent
/* signal info */
void (**(_sig_func))(int);
- /* These are here last so that __sFILE can grow without changing the offsets
+ /* These are here last so that __FILE can grow without changing the offsets
of the above members (on the off chance that future binary compatibility
would be broken otherwise). */
- struct _glue __sglue; /* root of glue chain */
- struct __sFILE __sf[3]; /* first three file descriptors */
+ struct _glue __sglue; /* root of glue chain */
+ __FILE __sf[3]; /* first three file descriptors */
};
#define _REENT_INIT(var) \