summaryrefslogtreecommitdiff
path: root/src/stats.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-02-02 09:40:48 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2011-02-03 01:06:44 +0100
commit0cc95cafe34d861dacdab6b75f395e43cdb1d777 (patch)
tree347a0146c22fbe351ffe367fe2c7e371987de5dc /src/stats.c
parentea2b82b91782bf7eba7b3b58a87d71a70201c7a6 (diff)
downloadconnman-0cc95cafe34d861dacdab6b75f395e43cdb1d777.tar.gz
connman-0cc95cafe34d861dacdab6b75f395e43cdb1d777.tar.bz2
connman-0cc95cafe34d861dacdab6b75f395e43cdb1d777.zip
stats: Add comment about MAP_SHARED
Clarify why MAP_SHARED is used instead of the obvious MAP_PRIVATE.
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 {