1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_PROFILING_MEMORY_WRAP_ALLOCATORS_H_ 18 #define SRC_PROFILING_MEMORY_WRAP_ALLOCATORS_H_ 19 20 #include <stdlib.h> 21 22 #include <cinttypes> 23 24 namespace perfetto { 25 namespace profiling { 26 27 void* wrap_malloc(uint32_t heap_id, void* (*fn)(size_t), size_t size); 28 void* wrap_calloc(uint32_t heap_id, 29 void* (*fn)(size_t, size_t), 30 size_t nmemb, 31 size_t size); 32 void* wrap_memalign(uint32_t heap_id, 33 void* (*fn)(size_t, size_t), 34 size_t alignment, 35 size_t size); 36 int wrap_posix_memalign(uint32_t heap_id, 37 int (*fn)(void**, size_t, size_t), 38 void** memptr, 39 size_t alignment, 40 size_t size); 41 void wrap_free(uint32_t heap_id, void (*fn)(void*), void* pointer); 42 void* wrap_realloc(uint32_t heap_id, 43 void* (*fn)(void*, size_t), 44 void* pointer, 45 size_t size); 46 void* wrap_pvalloc(uint32_t heap_id, void* (*fn)(size_t), size_t size); 47 void* wrap_valloc(uint32_t heap_id, void* (*fn)(size_t), size_t size); 48 49 void* wrap_reallocarray(uint32_t heap_id, 50 void* (*fn)(void*, size_t, size_t), 51 void* pointer, 52 size_t nmemb, 53 size_t size); 54 55 } // namespace profiling 56 } // namespace perfetto 57 58 #endif // SRC_PROFILING_MEMORY_WRAP_ALLOCATORS_H_ 59