blob: 34fb8983a7b876f0d2bf0e3c2b515851a039a654 [file] [log] [blame]
Josh Gao3c8fc2f2015-10-08 14:49:26 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef _PRIVATE_BIONIC_MALLOC_DISPATCH_H
30#define _PRIVATE_BIONIC_MALLOC_DISPATCH_H
31
32#include <stddef.h>
33#include "private/bionic_config.h"
34
35/* Entry in malloc dispatch table. */
36typedef void* (*MallocDebugCalloc)(size_t, size_t);
37typedef void (*MallocDebugFree)(void*);
38typedef struct mallinfo (*MallocDebugMallinfo)();
39typedef void* (*MallocDebugMalloc)(size_t);
40typedef size_t (*MallocDebugMallocUsableSize)(const void*);
41typedef void* (*MallocDebugMemalign)(size_t, size_t);
42typedef int (*MallocDebugPosixMemalign)(void**, size_t, size_t);
43#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
44typedef void* (*MallocDebugPvalloc)(size_t);
45#endif
46typedef void* (*MallocDebugRealloc)(void*, size_t);
47#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
48typedef void* (*MallocDebugValloc)(size_t);
49#endif
50
51struct MallocDebug {
52 MallocDebugCalloc calloc;
53 MallocDebugFree free;
54 MallocDebugMallinfo mallinfo;
55 MallocDebugMalloc malloc;
56 MallocDebugMallocUsableSize malloc_usable_size;
57 MallocDebugMemalign memalign;
58 MallocDebugPosixMemalign posix_memalign;
59#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
60 MallocDebugPvalloc pvalloc;
61#endif
62 MallocDebugRealloc realloc;
63#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
64 MallocDebugValloc valloc;
65#endif
66} __attribute__((aligned(32)));
67
68#endif