From: Daniel Wagner <[email protected]>
Clarify why MAP_SHARED is used instead of the obvious MAP_PRIVATE.
---
src/stats.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/stats.c b/src/stats.c
index 929e09b..45b067e 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 {
--
1.7.3.5
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman