diff options
author | Yifan Lu | 2016-10-04 19:51:51 -0700 |
---|---|---|
committer | Yifan Lu | 2016-10-04 19:51:51 -0700 |
commit | 4792258fd0b2dc7ac89d98b270e10264c5491e82 (patch) | |
tree | 54a44b939fb8f815f920bde71aa0b9223a2a842e /lib/hook-functions.c | |
parent | make ln command more robust (diff) | |
download | substitute-4792258fd0b2dc7ac89d98b270e10264c5491e82.tar.gz |
Added option to removed pthread dependency
Added option to remove dynamic linker stuff
Fixed a reference in strerror.c that depends on __APPLE__ being defined
Diffstat (limited to 'lib/hook-functions.c')
-rw-r--r-- | lib/hook-functions.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/hook-functions.c b/lib/hook-functions.c index fed9e3e..8363567 100644 --- a/lib/hook-functions.c +++ b/lib/hook-functions.c @@ -5,7 +5,9 @@ #include "transform-dis.h" #include "execmem.h" #include stringify(TARGET_DIR/jump-patch.h) +#ifndef NO_PTHREADS #include <pthread.h> +#endif struct hook_internal { int offset_by_pcdiff[MAX_EXTENDED_PATCH_SIZE + 1]; @@ -135,9 +137,13 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks, size_t nhooks, struct substitute_function_hook_record **recordp, int options) { +#ifndef NO_PTHREADS bool thread_safe = !(options & SUBSTITUTE_NO_THREAD_SAFETY); if (thread_safe && !pthread_main_np()) return SUBSTITUTE_ERR_NOT_ON_MAIN_THREAD; +#else + bool thread_safe = false; +#endif if (recordp) *recordp = NULL; |