summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-31 08:21:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:26 -0500
commit1f591a440059c848fc8ac7a940378a9ef5a1548e (patch)
treeacde7d70f2c66915c12e577d368585c4db0b03f8 /source4/lib
parent0575d5e0d2d1548ce2f6d133ccebe65a0b6b7745 (diff)
downloadsamba-1f591a440059c848fc8ac7a940378a9ef5a1548e.tar.gz
samba-1f591a440059c848fc8ac7a940378a9ef5a1548e.tar.bz2
samba-1f591a440059c848fc8ac7a940378a9ef5a1548e.zip
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)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/util_file.c24
1 files changed, 11 insertions, 13 deletions
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) {