diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 5b6817f6b5210f881b8f51ce7c8e042ce066bf8a..58c9a8383a35fd7d998d6847d7e2763ff4d50c66 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -240,13 +240,8 @@ enum ast_lock_type { * lock info struct. The lock is marked as pending as the thread is waiting * on the lock. ast_mark_lock_acquired() will mark it as held by this thread. */ -#ifdef HAVE_BKTR void ast_store_lock_info(enum ast_lock_type type, const char *filename, int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt); -#else -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr); -#endif /* HAVE_BKTR */ /*! * \brief Mark the last lock as acquired @@ -264,11 +259,7 @@ void ast_mark_lock_failed(void *lock_addr); * this gets called by ast_mutex_unlock so that information on the lock can * be removed from the current thread's lock info struct. */ -#ifdef HAVE_BKTR void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt); -#else -void ast_remove_lock_info(void *lock_addr); -#endif /* HAVE_BKTR */ void ast_suspend_lock_info(void *lock_addr); void ast_restore_lock_info(void *lock_addr); diff --git a/main/lock.c b/main/lock.c index 9c1d38383265b6086f3bcd2e18bd8e1690c7c6fc..dec814fb14abf41510c463996d720bd84c7c0014 100644 --- a/main/lock.c +++ b/main/lock.c @@ -245,9 +245,7 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func, #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -268,11 +266,8 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func, bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt); -#else - ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t); #endif + ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt); } #endif /* DEBUG_THREADS */ @@ -346,10 +341,8 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func, } else { bt = NULL; } - ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); #endif + ast_remove_lock_info(t, bt); } if (res) { __ast_mutex_logger("%s line %d (%s): Error obtaining mutex: %s\n", @@ -369,9 +362,7 @@ int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *fu #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -392,11 +383,8 @@ int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *fu bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt); -#else - ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t); #endif + ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt); } #endif /* DEBUG_THREADS */ @@ -433,9 +421,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE) if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) { @@ -483,11 +469,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun #endif ast_reentrancy_unlock(lt); -#ifdef HAVE_BKTR ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); -#endif } #endif /* DEBUG_THREADS */ @@ -773,9 +755,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif int lock_found = 0; #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE) @@ -825,11 +805,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw ast_reentrancy_unlock(lt); -#ifdef HAVE_BKTR ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); -#endif } #endif /* DEBUG_THREADS */ @@ -853,9 +829,7 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -876,11 +850,8 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ @@ -939,10 +910,8 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw } else { bt = NULL; } - ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); #endif + ast_remove_lock_info(t, bt); } if (res) { @@ -962,9 +931,7 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -985,11 +952,8 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ @@ -1048,10 +1012,8 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw } else { bt = NULL; } - ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); #endif + ast_remove_lock_info(t, bt); } if (res) { __ast_mutex_logger("%s line %d (%s): Error obtaining write lock: %s\n", @@ -1071,9 +1033,7 @@ int __ast_rwlock_timedrdlock(const char *filename, int line, const char *func, a #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -1094,11 +1054,8 @@ int __ast_rwlock_timedrdlock(const char *filename, int line, const char *func, a bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ @@ -1141,10 +1098,8 @@ int __ast_rwlock_timedrdlock(const char *filename, int line, const char *func, a } else { bt = NULL; } - ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); #endif + ast_remove_lock_info(t, bt); } if (res) { __ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n", @@ -1164,9 +1119,7 @@ int __ast_rwlock_timedwrlock(const char *filename, int line, const char *func, a #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; int canlog = t->tracking && strcmp(filename, "logger.c"); -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -1187,11 +1140,8 @@ int __ast_rwlock_timedwrlock(const char *filename, int line, const char *func, a bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ @@ -1234,10 +1184,8 @@ int __ast_rwlock_timedwrlock(const char *filename, int line, const char *func, a } else { bt = NULL; } - ast_remove_lock_info(t, bt); -#else - ast_remove_lock_info(t); #endif + ast_remove_lock_info(t, bt); } if (res) { __ast_mutex_logger("%s line %d (%s): Error obtaining read lock: %s\n", @@ -1255,9 +1203,7 @@ int __ast_rwlock_tryrdlock(const char *filename, int line, const char *func, ast #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -1278,11 +1224,8 @@ int __ast_rwlock_tryrdlock(const char *filename, int line, const char *func, ast bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ @@ -1314,9 +1257,7 @@ int __ast_rwlock_trywrlock(const char *filename, int line, const char *func, ast #ifdef DEBUG_THREADS struct ast_lock_track *lt = NULL; -#ifdef HAVE_BKTR struct ast_bt *bt = NULL; -#endif if (t->tracking) { lt = ast_get_reentrancy(&t->track); @@ -1337,11 +1278,8 @@ int __ast_rwlock_trywrlock(const char *filename, int line, const char *func, ast bt = <->backtrace[lt->reentrancy]; } ast_reentrancy_unlock(lt); - - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); -#else - ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t); #endif + ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt); } #endif /* DEBUG_THREADS */ diff --git a/main/utils.c b/main/utils.c index f20ccd36e44f0b669214e0a1fd9748d25bab77d2..a73bf9d42a70947b949e6823fd3b1d074b0bc59c 100644 --- a/main/utils.c +++ b/main/utils.c @@ -722,13 +722,8 @@ static void lock_info_destroy(void *data) AST_THREADSTORAGE_CUSTOM(thread_lock_info, NULL, lock_info_destroy); #endif /* ! LOW_MEMORY */ -#ifdef HAVE_BKTR void ast_store_lock_info(enum ast_lock_type type, const char *filename, int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt) -#else -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr) -#endif { #if !defined(LOW_MEMORY) struct thr_lock_info *lock_info; @@ -910,11 +905,7 @@ void ast_restore_lock_info(void *lock_addr) } -#ifdef HAVE_BKTR void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt) -#else -void ast_remove_lock_info(void *lock_addr) -#endif { #if !defined(LOW_MEMORY) struct thr_lock_info *lock_info; diff --git a/utils/ael_main.c b/utils/ael_main.c index f22e9a05b2e010710df6da44a636be946e5a4d84..3a91ef16704ba735356346d279efecfea106e7d3 100644 --- a/utils/ael_main.c +++ b/utils/ael_main.c @@ -601,7 +601,6 @@ unsigned int ast_hashtab_hash_contexts(const void *obj) void ast_mark_lock_acquired(void *lock_addr) { } -#ifdef HAVE_BKTR void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt) { } @@ -611,6 +610,7 @@ void ast_store_lock_info(enum ast_lock_type type, const char *filename, { } +#ifdef HAVE_BKTR int __ast_bt_get_addresses(struct ast_bt *bt) { return 0; @@ -627,15 +627,6 @@ char **__ast_bt_get_symbols(void **addresses, size_t num_frames) } return foo; } -#else -void ast_remove_lock_info(void *lock_addr) -{ -} - -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr) -{ -} #endif /* HAVE_BKTR */ void ast_suspend_lock_info(void *lock_addr) { diff --git a/utils/check_expr.c b/utils/check_expr.c index 201fa04d214af2dbc916c1c99b08945e5082c0d3..e15705e1b8582ea349177d7e83191870e7e3aebb 100644 --- a/utils/check_expr.c +++ b/utils/check_expr.c @@ -55,7 +55,6 @@ void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, i #endif #ifdef DEBUG_THREADS -#ifdef HAVE_BKTR void ast_store_lock_info(enum ast_lock_type type, const char *filename, int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt); void ast_store_lock_info(enum ast_lock_type type, const char *filename, @@ -70,6 +69,7 @@ void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt) /* not a lot to do in a standalone w/o threading! */ } +#ifdef HAVE_BKTR int __ast_bt_get_addresses(struct ast_bt *bt); int __ast_bt_get_addresses(struct ast_bt *bt) { @@ -88,20 +88,6 @@ char **__ast_bt_get_symbols(void **addresses, size_t num_frames) } return foo; } -#else -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr); -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr) -{ - /* not a lot to do in a standalone w/o threading! */ -} - -void ast_remove_lock_info(void *lock_addr); -void ast_remove_lock_info(void *lock_addr) -{ - /* not a lot to do in a standalone w/o threading! */ -} #endif /* HAVE_BKTR */ void ast_suspend_lock_info(void *lock_addr) diff --git a/utils/conf2ael.c b/utils/conf2ael.c index 5fdc570a0207454f5a1c7e171c1a32fa43c23050..567dc56f1cfd4e849f9748460b51eff12d8d77ce 100644 --- a/utils/conf2ael.c +++ b/utils/conf2ael.c @@ -699,7 +699,6 @@ unsigned int ast_hashtab_hash_contexts(const void *obj) void ast_mark_lock_acquired(void *lock_addr) { } -#ifdef HAVE_BKTR void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt) { } @@ -709,6 +708,7 @@ void ast_store_lock_info(enum ast_lock_type type, const char *filename, { } +#ifdef HAVE_BKTR int __ast_bt_get_addresses(struct ast_bt *bt) { return 0; @@ -725,16 +725,6 @@ char **__ast_bt_get_symbols(void **addresses, size_t num_frames) } return foo; } - -#else -void ast_remove_lock_info(void *lock_addr) -{ -} - -void ast_store_lock_info(enum ast_lock_type type, const char *filename, - int line_num, const char *func, const char *lock_name, void *lock_addr) -{ -} #endif /* HAVE_BKTR */ void ast_suspend_lock_info(void *lock_addr) {