diff options
author | Pascal Obry <obry@adacore.com> | 2014-08-01 08:24:09 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 10:24:09 +0200 |
commit | 8616f0a2d8927cb6a8e1d85a97db758d3b238fe1 (patch) | |
tree | f23e41b7511333fa0b62a522beb0d5ec25e2d701 /gcc | |
parent | a62828520413d90d5dd11c43068b31a46d4fbd75 (diff) | |
download | gcc-8616f0a2d8927cb6a8e1d85a97db758d3b238fe1.zip gcc-8616f0a2d8927cb6a8e1d85a97db758d3b238fe1.tar.gz gcc-8616f0a2d8927cb6a8e1d85a97db758d3b238fe1.tar.bz2 |
cstreams.c: Only enable large file support on know supported platforms.
2014-08-01 Pascal Obry <obry@adacore.com>
* cstreams.c: Only enable large file support on know supported
platforms. Add missing defines/includes.
From-SVN: r213420
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/cstreams.c | 32 |
2 files changed, 36 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1c81d98..aa296da 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2014-08-01 Pascal Obry <obry@adacore.com> + + * cstreams.c: Only enable large file support on know supported + platforms. Add missing defines/includes. + 2014-08-01 Ed Schonberg <schonberg@adacore.com> * einfo.ads, einfo.adb New flags No_Predicate_On_Actual and diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c index a58d9e5..23f7480 100644 --- a/gcc/ada/cstreams.c +++ b/gcc/ada/cstreams.c @@ -31,12 +31,19 @@ /* Routines required for implementing routines in Interfaces.C.Streams. */ +#define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 /* the define above will make off_t a 64bit type on GNU/Linux */ #include <stdio.h> #include <sys/types.h> +#ifdef _AIX +/* needed to avoid conflicting declarations */ +#include <unistd.h> +#include <sys/mman.h> +#endif + #ifdef __vxworks #include "vxWorks.h" #endif @@ -268,7 +275,10 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin) return _fseeki64 (stream, offset, origin); } -#else +#elif defined(linux) || defined(sun) \ + || defined (__FreeBSD__) || defined(__APPLE__) +/* section for platforms having ftello/fseeko */ + __int64 __gnat_ftell64 (FILE *stream) { @@ -286,6 +296,26 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin) else return -1; } + +#else + +__int64 +__gnat_ftell64 (FILE *stream) +{ + return (__int64)ftell (stream); +} + +int +__gnat_fseek64 (FILE *stream, __int64 offset, int origin) +{ + /* make sure that the offset is not bigger than the OS off_t, if so return + with error as this mean that we are trying to handle files larger than + 2Gb on a patform not supporting it. */ + if ((off_t)offset == offset) + return fseek (stream, (off_t) offset, origin); + else + return -1; +} #endif #ifdef __cplusplus |