summaryrefslogtreecommitdiff
path: root/src/stats.c
diff options
context:
space:
mode:
authorGrant Erickson <marathon96@gmail.com>2011-03-03 10:44:57 -0800
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-04 11:46:18 +0100
commit7e70a0c258d4496c3243b8bc1e77d1b60e9a275b (patch)
tree5234c812db8eedcb0f6656c5d4524c34ae0ec367 /src/stats.c
parented896f9789f7c808fb86b4534cbd4eccfa401e82 (diff)
downloadconnman-7e70a0c258d4496c3243b8bc1e77d1b60e9a275b.tar.gz
connman-7e70a0c258d4496c3243b8bc1e77d1b60e9a275b.tar.bz2
connman-7e70a0c258d4496c3243b8bc1e77d1b60e9a275b.zip
stats: Add an informational message for mmap failures
Added an informational message when mmap fails with EINVAL in stats_file_remap.
Diffstat (limited to 'src/stats.c')
-rw-r--r--src/stats.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/stats.c b/src/stats.c
index 30c0169d..c4aa24e5 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -293,9 +293,10 @@ 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.
+ * have to take MAP_SHARED because MAP_PRIVATE does not
+ * guarantee that writes will hit the file without an explicit
+ * call to munmap or msync. For more details please read the
+ * mmap man pages.
*/
addr = mmap(NULL, new_size, PROT_READ | PROT_WRITE,
MAP_SHARED, file->fd, 0);
@@ -306,6 +307,11 @@ static int stats_file_remap(struct stats_file *file, size_t size)
if (addr == MAP_FAILED) {
connman_error("mmap error %s for %s",
strerror(errno), file->name);
+ if (errno == EINVAL) {
+ connman_error("%s might be on a file system, such as "
+ "JFFS2, that does not allow shared "
+ "writable mappings.", file->name);
+ }
return -errno;
}