summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/mmap.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mmap.c b/src/mmap.c
index 3d57b11..273f64c 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -35,2 +35,10 @@
35 35
36# if defined(MAP_POPULATE)
37# define GDBM_MMAP_FLAGS MAP_POPULATE
38# elif defined(MAP_PREFAULT_READ)
39# define GDBM_MMAP_FLAGS MAP_PREFAULT_READ
40# else
41# define GDBM_MMAP_FLAGS 0
42# endif
43
36/* Translate current offset in the mapped region into the absolute position */ 44/* Translate current offset in the mapped region into the absolute position */
@@ -92,3 +100,3 @@ _gdbm_internal_remap (GDBM_FILE dbf, size_t size)
92 void *p; 100 void *p;
93 int flags = PROT_READ; 101 int prot = PROT_READ;
94 size_t page_size = sysconf (_SC_PAGESIZE); 102 size_t page_size = sysconf (_SC_PAGESIZE);
@@ -109,5 +117,5 @@ _gdbm_internal_remap (GDBM_FILE dbf, size_t size)
109 if (dbf->read_write) 117 if (dbf->read_write)
110 flags |= PROT_WRITE; 118 prot |= PROT_WRITE;
111 119
112 p = mmap (NULL, dbf->mapped_size, flags, MAP_SHARED, 120 p = mmap (NULL, dbf->mapped_size, prot, MAP_SHARED | GDBM_MMAP_FLAGS,
113 dbf->desc, dbf->mapped_off); 121 dbf->desc, dbf->mapped_off);

Return to:

Send suggestions and report system problems to the System administrator.