check for munmap as well as mmap. NextStep only has mmap in standard
authorAndrew Tridgell <tridge@samba.org>
Tue, 26 May 1998 14:18:59 +0000 (14:18 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 26 May 1998 14:18:59 +0000 (14:18 +0000)
libs

configure.in
rsync.h
syscall.c
util.c

index ab4c097..f328b9a 100644 (file)
@@ -39,7 +39,7 @@ echo no)
 
 AC_FUNC_MEMCMP
 AC_FUNC_UTIME_NULL
-AC_CHECK_FUNCS(mmap waitpid getcwd strdup strerror chown chmod mknod)
+AC_CHECK_FUNCS(mmap munmap waitpid getcwd strdup strerror chown chmod mknod)
 AC_CHECK_FUNCS(fchmod fstat strchr bcopy bzero readlink link utime utimes)
 AC_CHECK_FUNCS(memmove getopt_long lchown setlinebuf vsnprintf setsid glob)
 
diff --git a/rsync.h b/rsync.h
index f98ca6a..7e2967b 100644 (file)
--- a/rsync.h
+++ b/rsync.h
 #endif
 #include <errno.h>
 
-#ifdef HAVE_MMAP
+#if defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
 #include <sys/mman.h>
+#define USE_MMAP 1
 #endif
 
 #ifdef HAVE_UTIME_H
index a8470e1..16d0a96 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -149,7 +149,7 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
 #endif
 }
 
-#if HAVE_MMAP
+#ifdef USE_MMAP
 void *do_mmap(void *start, int len, int prot, int flags, int fd, OFF_T offset)
 {
 #if HAVE_OFF64_T
diff --git a/util.c b/util.c
index b94262f..f54acd2 100644 (file)
--- a/util.c
+++ b/util.c
@@ -46,7 +46,7 @@ struct map_struct *map_file(int fd,OFF_T len)
        ret->p_offset = 0;
        ret->p_len = 0;
 
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
        len = MIN(len, MAX_MAP_SIZE);
        ret->map = (char *)do_mmap(NULL,len,PROT_READ,MAP_SHARED,fd,0);
        if (ret->map == (char *)-1) {
@@ -69,7 +69,7 @@ char *map_ptr(struct map_struct *map,OFF_T offset,int len)
        if (len > (map->size-offset))
                len = map->size-offset;
 
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
        if (map->map) {
                if (offset >= map->p_offset && 
                    offset+len <= map->p_offset+map->p_len) {
@@ -143,7 +143,7 @@ char *map_ptr(struct map_struct *map,OFF_T offset,int len)
 
 void unmap_file(struct map_struct *map)
 {
-#ifdef HAVE_MMAP
+#ifdef USE_MMAP
        if (map->map) {
                munmap(map->map,map->p_len);
                map->map = NULL;