1 #ifdef HOOK_ENABLE 2 #include "musl_preinit_common.h" 3 #include "musl_malloc.h" 4 #include <stdatomic.h> 5 #include <malloc.h> 6 #include <stdlib.h> 7 8 struct musl_libc_globals __musl_libc_globals; 9 10 struct MallocDispatchType __libc_malloc_default_dispatch = { 11 .malloc = MuslFunc(malloc), 12 .free = MuslFunc(free), 13 .mmap = MuslMalloc(mmap), 14 .munmap = MuslMalloc(munmap), 15 .calloc = MuslFunc(calloc), 16 .realloc = MuslFunc(realloc), 17 .malloc_usable_size = MuslMalloc(malloc_usable_size), 18 .prctl = MuslMalloc(prctl), 19 }; 20 21 volatile atomic_bool __hook_enable_hook_flag; 22 volatile atomic_bool __memleak_hook_flag; 23 24 #endif 25