projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea2b82b
)
stats: Add comment about MAP_SHARED
author
Daniel Wagner
<daniel.wagner@bmw-carit.de>
Wed, 2 Feb 2011 08:40:48 +0000
(09:40 +0100)
committer
Samuel Ortiz
<sameo@linux.intel.com>
Thu, 3 Feb 2011 00:06:44 +0000
(
01:06
+0100)
Clarify why MAP_SHARED is used instead of the obvious MAP_PRIVATE.
src/stats.c
patch
|
blob
|
history
diff --git
a/src/stats.c
b/src/stats.c
index
929e09b
..
679a372
100644
(file)
--- 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 {