summaryrefslogtreecommitdiff
path: root/src/stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stats.c')
-rw-r--r--src/stats.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stats.c b/src/stats.c
index 929e09bf..679a372e 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -286,6 +286,12 @@ static int stats_file_remap(struct stats_file *file, size_t size)
}
if (file->addr == NULL) {
+ /*
+ * Though the buffer is not shared between processes, we still
+ * have to take MAP_SHARED because MAP_PRIVATE does not guarantee
+ * that writes will hit the file eventually. For more details
+ * please read the mmap man pages.
+ */
addr = mmap(NULL, new_size, PROT_READ | PROT_WRITE,
MAP_SHARED, file->fd, 0);
} else {