From 1f591a440059c848fc8ac7a940378a9ef5a1548e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 31 Aug 2004 08:21:29 +0000 Subject: r2125: the lp_use_mmap() in map_file() is inappropriate for 2 reasons, so I have removed it. - lp_use_mmap() is really meant to cope with systems that have broken mmap coherence, but map_file() doesn't need coherence, as its maps read only - map_file() is used to map the charset files before loadparm has loaded, so lp_use_mmap() is always returning false for the major use of map_file() (This used to be commit dbe786f61e3de0758f95f2abd1b15a4c320432ca) --- source4/lib/util_file.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'source4') diff --git a/source4/lib/util_file.c b/source4/lib/util_file.c index a5832adec5..51e6c7187e 100644 --- a/source4/lib/util_file.c +++ b/source4/lib/util_file.c @@ -366,19 +366,17 @@ void *map_file(char *fname, size_t size) size_t s2 = 0; void *p = NULL; #ifdef HAVE_MMAP - if (lp_use_mmap()) { - int fd; - fd = open(fname, O_RDONLY, 0); - if (fd == -1) { - DEBUG(2,("Failed to load %s - %s\n", fname, strerror(errno))); - return NULL; - } - p = mmap(NULL, size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0); - close(fd); - if (p == MAP_FAILED) { - DEBUG(1,("Failed to mmap %s - %s\n", fname, strerror(errno))); - return NULL; - } + int fd; + fd = open(fname, O_RDONLY, 0); + if (fd == -1) { + DEBUG(2,("Failed to load %s - %s\n", fname, strerror(errno))); + return NULL; + } + p = mmap(NULL, size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0); + close(fd); + if (p == MAP_FAILED) { + DEBUG(1,("Failed to mmap %s - %s\n", fname, strerror(errno))); + return NULL; } #endif if (!p) { -- cgit