From e0df58f589bfd80da7284ddd6ce2a6cd852d663e Mon Sep 17 00:00:00 2001 From: Phong Tran Date: Sun, 14 Oct 2018 09:39:10 +0700 Subject: 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 --- include/android/sharedmem.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/android/sharedmem.h') 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 * -- cgit v1.2.3-59-g8ed1b