1 /*
2  * Copyright (C) 2019 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 #pragma once
30 
31 #include <stdint.h>
32 #include <stdio.h>
33 #include <malloc.h>
34 
35 #include <private/bionic_config.h>
36 
37 __BEGIN_DECLS
38 
39 void* scudo_aligned_alloc(size_t, size_t);
40 void* scudo_calloc(size_t, size_t);
41 void scudo_free(void*);
42 struct mallinfo scudo_mallinfo();
43 void* scudo_malloc(size_t);
44 int scudo_malloc_info(int, FILE*);
45 size_t scudo_malloc_usable_size(const void*);
46 int scudo_mallopt(int, int);
47 void* scudo_memalign(size_t, size_t);
48 void* scudo_realloc(void*, size_t);
49 int scudo_posix_memalign(void**, size_t, size_t);
50 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
51 void* scudo_pvalloc(size_t);
52 void* scudo_valloc(size_t);
53 #endif
54 
55 int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
56 void scudo_malloc_disable();
57 void scudo_malloc_enable();
58 
59 void* scudo_svelte_aligned_alloc(size_t, size_t);
60 void* scudo_svelte_calloc(size_t, size_t);
61 void scudo_svelte_free(void*);
62 struct mallinfo scudo_svelte_mallinfo();
63 void* scudo_svelte_malloc(size_t);
64 int scudo_svelte_malloc_info(int, FILE*);
65 size_t scudo_svelte_malloc_usable_size(const void*);
66 int scudo_svelte_mallopt(int, int);
67 void* scudo_svelte_memalign(size_t, size_t);
68 void* scudo_svelte_realloc(void*, size_t);
69 int scudo_svelte_posix_memalign(void**, size_t, size_t);
70 #if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
71 void* scudo_svelte_pvalloc(size_t);
72 void* scudo_svelte_valloc(size_t);
73 #endif
74 
75 int scudo_svelte_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*);
76 void scudo_svelte_malloc_disable();
77 void scudo_svelte_malloc_enable();
78 
79 __END_DECLS
80