Commit bb0f7089 authored by Andrew Tridgell's avatar Andrew Tridgell

check for munmap as well as mmap. NextStep only has mmap in standard

libs
parent 1ff5450d
......@@ -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)
......
......@@ -142,8 +142,9 @@
#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
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment