summaryrefslogtreecommitdiff
path: root/source3/lib/util_file.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-17 11:13:57 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-17 11:13:57 +0000
commitcf5a038adf0bd609e00039b44e197ea589eeb9cb (patch)
tree9da51f4e021e6ae6b8a81c71f53ab1781f25e986 /source3/lib/util_file.c
parented5db6cc45aa8535e589aaef0d9bcf1075713260 (diff)
downloadsamba-cf5a038adf0bd609e00039b44e197ea589eeb9cb.tar.gz
obey "use mmap" on case tables
(This used to be commit 505a1bdd15313698a6024a847f3771ea30a51f89)
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r--source3/lib/util_file.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index 5ecf526280f..0cd60fed268 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -430,17 +430,19 @@ void *map_file(char *fname, size_t size)
size_t s2 = 0;
void *p = NULL;
#ifdef HAVE_MMAP
- int fd;
- fd = open(fname, O_RDONLY, 0);
- if (fd == -1) {
- DEBUG(1,("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;
+ if (lp_use_mmap()) {
+ int fd;
+ fd = open(fname, O_RDONLY, 0);
+ if (fd == -1) {
+ DEBUG(1,("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) {