diff options
Diffstat (limited to 'src/pages.c')
-rw-r--r-- | src/pages.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pages.c b/src/pages.c index 83a167f..993c0a6 100644 --- a/src/pages.c +++ b/src/pages.c @@ -2,6 +2,17 @@ #include "jemalloc/internal/jemalloc_internal.h" /******************************************************************************/ +/* Defines/includes needed for special android code. */ + +#if defined(__ANDROID__) +#include <sys/prctl.h> + +/* Definitions of prctl arguments to set a vma name in Android kernels. */ +#define ANDROID_PR_SET_VMA 0x53564d41 +#define ANDROID_PR_SET_VMA_ANON_NAME 0 +#endif + +/******************************************************************************/ void * pages_map(void *addr, size_t size) @@ -36,6 +47,13 @@ pages_map(void *addr, size_t size) ret = NULL; } #endif +#if defined(__ANDROID__) + if (ret != NULL) { + /* Name this memory as being used by libc */ + prctl(ANDROID_PR_SET_VMA, ANDROID_PR_SET_VMA_ANON_NAME, ret, + size, "libc_malloc"); + } +#endif assert(ret == NULL || (addr == NULL && ret != addr) || (addr != NULL && ret == addr)); return (ret); |