1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __ohos_malloc_hook_client_h__ 17 #define __ohos_malloc_hook_client_h__ 18 19 #include <stdlib.h> 20 #include "musl_malloc_dispatch.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 bool ohos_malloc_hook_initialize(const MallocDispatchType*, bool*, const char*); 27 bool ohos_malloc_hook_get_hook_flag(void); 28 bool ohos_malloc_hook_set_hook_flag(bool); 29 void ohos_malloc_hook_finalize(void); 30 bool ohos_malloc_hook_on_start(void); 31 bool ohos_malloc_hook_on_end(void); 32 void* ohos_malloc_hook_malloc(size_t); 33 void* ohos_malloc_hook_realloc(void*, size_t); 34 void* ohos_malloc_hook_calloc(size_t, size_t); 35 void* ohos_malloc_hook_valloc(size_t); 36 void ohos_malloc_hook_free(void*); 37 void* ohos_malloc_hook_memalign(size_t, size_t); 38 size_t ohos_malloc_hook_malloc_usable_size(void*); 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 45 #endif /* __ohos_malloc_hook_client_h__ */