summaryrefslogtreecommitdiff
path: root/mmap/unix
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-03-27 13:11:18 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-03-27 13:11:18 +0000
commit263ebecba3310066882fe83f7309c4f101ff34d2 (patch)
tree5919e52a5b6b9ae68ac09f9e288751d4b6a8034f /mmap/unix
parentc3da8b59b2241ac249f2e52e06aec980a69769d8 (diff)
downloadlibapr-263ebecba3310066882fe83f7309c4f101ff34d2.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: http://svn.apache.org/repos/asf/apr/apr/trunk@65027 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'mmap/unix')
-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;