1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

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)
This commit is contained in:
Andrew Tridgell 2004-08-31 08:21:29 +00:00 committed by Gerald (Jerry) Carter
parent 0575d5e0d2
commit 1f591a4400

View File

@ -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) {