diff options
| author | 2018-10-17 00:55:43 +0000 | |
|---|---|---|
| committer | 2018-10-17 00:55:43 +0000 | |
| commit | 080dadba41301c93eb78ef1e177a781ca3e4fa48 (patch) | |
| tree | 451e419f0d59eb83e432b178891ded9b12c19d34 | |
| parent | c7e86caf44cf8eab04c891346b5c4ff194fe230d (diff) | |
| parent | e0df58f589bfd80da7284ddd6ce2a6cd852d663e (diff) | |
Merge "ashmem: update example code of create shmem region"
| -rw-r--r-- | include/android/sharedmem.h | 3 |
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 * |