summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Phong Tran <tranmanphong@gmail.com> 2018-10-14 09:39:10 +0700
committer Phong Tran <tranmanphong@gmail.com> 2018-10-14 09:41:44 +0700
commite0df58f589bfd80da7284ddd6ce2a6cd852d663e (patch)
tree2a857d9178148eb1cf909b84dd61608169f90df1
parent20403620348805fac031ba7b0a6b32aa06a4a856 (diff)
ashmem: update example code of create shmem region
there is a lacking one parameter of mmap() in the example code. Signed-off-by: Phong Tran <tranmanphong@gmail.com>
-rw-r--r--include/android/sharedmem.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/android/sharedmem.h b/include/android/sharedmem.h
index 8c3ff747ce..7f5177bde9 100644
--- a/include/android/sharedmem.h
+++ b/include/android/sharedmem.h
@@ -94,7 +94,8 @@ size_t ASharedMemory_getSize(int fd) __INTRODUCED_IN(26);
* int fd = ASharedMemory_create("memory", 128);
*
* // By default it has PROT_READ | PROT_WRITE | PROT_EXEC.
- * char *buffer = (char *) mmap(NULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ * size_t memSize = ASharedMemory_getSize(fd);
+ * char *buffer = (char *) mmap(NULL, memSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
*
* strcpy(buffer, "This is an example."); // trivially initialize content
*