summaryrefslogtreecommitdiffstats
path: root/libc/bionic/malloc_debug_common.h
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2010-02-12 08:59:58 -0800
committerVladimir Chtchetkine <vchtchetkine@google.com>2010-02-16 11:43:18 -0800
commit75fba6888a1e5738f8255f3511c4ad40cbcc0eda (patch)
treede49c9233770c63324539012655792937875a5c2 /libc/bionic/malloc_debug_common.h
parent5c734644eebf8d01be1e86cbe20a111a5c5a2738 (diff)
downloadbionic-75fba6888a1e5738f8255f3511c4ad40cbcc0eda.zip
bionic-75fba6888a1e5738f8255f3511c4ad40cbcc0eda.tar.gz
bionic-75fba6888a1e5738f8255f3511c4ad40cbcc0eda.tar.bz2
Merge memory checking functionality from sandbox
Change-Id: I304c789a752c9f4af4944ca14b9bf1e7644da15a
Diffstat (limited to 'libc/bionic/malloc_debug_common.h')
-rw-r--r--libc/bionic/malloc_debug_common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libc/bionic/malloc_debug_common.h b/libc/bionic/malloc_debug_common.h
index a6301b3..87600d6 100644
--- a/libc/bionic/malloc_debug_common.h
+++ b/libc/bionic/malloc_debug_common.h
@@ -70,13 +70,28 @@ struct HashTable {
/* Entry in malloc dispatch table. */
typedef struct MallocDebug MallocDebug;
struct MallocDebug {
+ /* Address of the actual malloc routine. */
void* (*malloc)(size_t bytes);
+ /* Address of the actual free routine. */
void (*free)(void* mem);
+ /* Address of the actual calloc routine. */
void* (*calloc)(size_t n_elements, size_t elem_size);
+ /* Address of the actual realloc routine. */
void* (*realloc)(void* oldMem, size_t bytes);
+ /* Address of the actual memalign routine. */
void* (*memalign)(size_t alignment, size_t bytes);
};
+/* Malloc debugging initialization routine.
+ * This routine must be implemented in .so modules that implement malloc
+ * debugging. This routine is called once per process from malloc_init_impl
+ * routine implemented in bionic/libc/bionic/malloc_debug_common.c when malloc
+ * debugging gets initialized for the process.
+ * Return:
+ * 0 on success, -1 on failure.
+ */
+typedef int (*MallocDebugInit)(void);
+
#ifdef __cplusplus
}; /* end of extern "C" */
#endif