summaryrefslogtreecommitdiff
path: root/mmap
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2004-03-27 13:11:18 +0000
committerJoe Orton <jorton@apache.org>2004-03-27 13:11:18 +0000
commit5ade1c1a116593f170f1cb9463f4824d3dc1258f (patch)
tree5919e52a5b6b9ae68ac09f9e288751d4b6a8034f /mmap
parent6e60ed822c0d68a98d10a76ed37cdfb2cb176236 (diff)
downloadapr-5ade1c1a116593f170f1cb9463f4824d3dc1258f.tar.gz
Add LFS support:
* configure.in: Check for off64_t and necessary LFS functions, define apr_off_t as off64_t where available. Add --disable-lfs flag. Forward-port changes from 0.9.5 to define apr_off_t as long on systems systems with a 32-bit off_t which don't have LFS enabled. * include/apr.h.in: Let configure define APR_HAS_LARGE_FILES. * include/arch/netware/apr_arch_file_io.h: Redefine lseek and ftruncate. * include/arch/unix/apr_arch_file_io.h: Redefine stat, lstat, fstat, lseek, ftruncate here; define struct_stat. * file_io/unix/filestat.c: Use struct_stat. * file_io/unix/mktemp.c: Use mkstemp64 where available. * file_io/unix/open.c (apr_file_open): Use O_LARGEFILE by default when LFS is enabled. * file_io/unix/readwrite.c, file_io/unix/seek.c: Don't redefine lseek and ftruncate here. * mmap/unix/mmap.c (apr_mmap_create): Use mmap64 if available; otherwise check for overflow when LFS is enabled. * network_io/unix/sendrecv.c (apr_socket_sendfile) [Linux/HPUX]: Use sendfile64 if available; otherwise check for overflow when LFS is enabled. [solaris]: Use sendfilev64/sendfilevec64_t. * test/Makefile.in, test/test_apr.h, test/testlfs.c: Add tests. Reviewed by: Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65027 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'mmap')
-rw-r--r--mmap/unix/mmap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mmap/unix/mmap.c b/mmap/unix/mmap.c
index 44cdbedb0..05d3f72ef 100644
--- a/mmap/unix/mmap.c
+++ b/mmap/unix/mmap.c
@@ -83,6 +83,14 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new,
apr_int32_t native_flags = 0;
#endif
+#if APR_HAS_LARGE_FILES && defined(HAVE_MMAP64)
+#define mmap mmap64
+#elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4
+ /* LFS but no mmap64: check for overflow */
+ if ((apr_int64_t)offset + size > INT_MAX)
+ return APR_EINVAL;
+#endif
+
if (size == 0)
return APR_EINVAL;