提交 bbcef13f 编写于 作者: S shuxinyia

修改musl 解决TDD 测试失败的问题。

Signed-off-by: NshuxinyiA <zhangcui11@huawei.com>
Signed-off-by: Nshuxinyia <shuxinyi4@h-partners.com>
上级 3ebdcba1
...@@ -39,18 +39,13 @@ extern "C" { ...@@ -39,18 +39,13 @@ extern "C" {
__attribute__((always_inline)) __attribute__((always_inline))
inline bool __get_global_hook_flag() inline bool __get_global_hook_flag()
{ {
#ifdef HOOK_ENABLE
volatile bool g_flag = atomic_load_explicit(&__hook_enable_hook_flag, memory_order_acquire); volatile bool g_flag = atomic_load_explicit(&__hook_enable_hook_flag, memory_order_acquire);
return g_flag; return g_flag;
#else
return false;
#endif
} }
__attribute__((always_inline)) __attribute__((always_inline))
inline bool __get_hook_flag() inline bool __get_hook_flag()
{ {
#ifdef HOOK_ENABLE
volatile void* impl_handle = (void *)atomic_load_explicit(&ohos_malloc_hook_shared_liibrary, memory_order_acquire); volatile void* impl_handle = (void *)atomic_load_explicit(&ohos_malloc_hook_shared_liibrary, memory_order_acquire);
if (impl_handle == NULL) { if (impl_handle == NULL) {
return false; return false;
...@@ -63,15 +58,11 @@ inline bool __get_hook_flag() ...@@ -63,15 +58,11 @@ inline bool __get_hook_flag()
bool flag = get_hook_func_ptr(); bool flag = get_hook_func_ptr();
return flag; return flag;
} }
#else
return false;
#endif
} }
__attribute__((always_inline)) __attribute__((always_inline))
inline bool __set_hook_flag(bool flag) inline bool __set_hook_flag(bool flag)
{ {
#ifdef HOOK_ENABLE
volatile void* impl_handle = (void *)atomic_load_explicit(&ohos_malloc_hook_shared_liibrary, memory_order_acquire); volatile void* impl_handle = (void *)atomic_load_explicit(&ohos_malloc_hook_shared_liibrary, memory_order_acquire);
if (impl_handle == NULL) { if (impl_handle == NULL) {
return false; return false;
...@@ -83,15 +74,11 @@ inline bool __set_hook_flag(bool flag) ...@@ -83,15 +74,11 @@ inline bool __set_hook_flag(bool flag)
SetHookFlagType set_hook_func_ptr = (SetHookFlagType)(function_of_shared_lib[SET_HOOK_FLAG_FUNCTION]); SetHookFlagType set_hook_func_ptr = (SetHookFlagType)(function_of_shared_lib[SET_HOOK_FLAG_FUNCTION]);
return set_hook_func_ptr(flag); return set_hook_func_ptr(flag);
} }
#else
return false;
#endif
} }
__attribute__((always_inline)) __attribute__((always_inline))
inline volatile const struct MallocDispatchType* get_current_dispatch_table() inline volatile const struct MallocDispatchType* get_current_dispatch_table()
{ {
#ifdef HOOK_ENABLE
volatile const struct MallocDispatchType* ret = (struct MallocDispatchType *)atomic_load_explicit(&__musl_libc_globals.current_dispatch_table, memory_order_acquire); volatile const struct MallocDispatchType* ret = (struct MallocDispatchType *)atomic_load_explicit(&__musl_libc_globals.current_dispatch_table, memory_order_acquire);
if (ret != NULL) { if (ret != NULL) {
if (!__get_global_hook_flag()) { if (!__get_global_hook_flag()) {
...@@ -102,9 +89,6 @@ inline volatile const struct MallocDispatchType* get_current_dispatch_table() ...@@ -102,9 +89,6 @@ inline volatile const struct MallocDispatchType* get_current_dispatch_table()
} }
} }
return ret; return ret;
#else
return NULL;
#endif
} }
#define MUSL_HOOK_PARAM_NAME "libc.hook_mode" #define MUSL_HOOK_PARAM_NAME "libc.hook_mode"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册