1 | #ifndef JEMALLOC_INTERNAL_TEST_HOOKS_H |
2 | #define JEMALLOC_INTERNAL_TEST_HOOKS_H |
3 | |
4 | extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(); |
5 | extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(); |
6 | |
7 | #if defined(JEMALLOC_JET) || defined(JEMALLOC_UNIT_TEST) |
8 | # define JEMALLOC_TEST_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) |
9 | |
10 | # define open JEMALLOC_TEST_HOOK(open, test_hooks_libc_hook) |
11 | # define read JEMALLOC_TEST_HOOK(read, test_hooks_libc_hook) |
12 | # define write JEMALLOC_TEST_HOOK(write, test_hooks_libc_hook) |
13 | # define readlink JEMALLOC_TEST_HOOK(readlink, test_hooks_libc_hook) |
14 | # define close JEMALLOC_TEST_HOOK(close, test_hooks_libc_hook) |
15 | # define creat JEMALLOC_TEST_HOOK(creat, test_hooks_libc_hook) |
16 | # define secure_getenv JEMALLOC_TEST_HOOK(secure_getenv, test_hooks_libc_hook) |
17 | /* Note that this is undef'd and re-define'd in src/prof.c. */ |
18 | # define _Unwind_Backtrace JEMALLOC_TEST_HOOK(_Unwind_Backtrace, test_hooks_libc_hook) |
19 | #else |
20 | # define JEMALLOC_TEST_HOOK(fn, hook) fn |
21 | #endif |
22 | |
23 | |
24 | #endif /* JEMALLOC_INTERNAL_TEST_HOOKS_H */ |
25 | |