1 --- a/include/asterisk/lock.h
2 +++ b/include/asterisk/lock.h
13 #ifndef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
14 #include "asterisk/time.h"
16 #define __AST_RWLOCK_INIT_VALUE {0}
17 #endif /* HAVE_PTHREAD_RWLOCK_INITIALIZER */
21 #define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, {{{ 0 }}}, PTHREAD_MUTEX_INIT_VALUE }
23 #define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, PTHREAD_MUTEX_INIT_VALUE }
26 +#define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, PTHREAD_MUTEX_INIT_VALUE }
29 #define AST_MUTEX_INIT_VALUE { PTHREAD_MUTEX_INIT_VALUE, NULL, 1 }
30 #define AST_MUTEX_INIT_VALUE_NOTRACKING { PTHREAD_MUTEX_INIT_VALUE, NULL, 0 }
31 @@ -114,9 +120,11 @@ struct ast_lock_track {
33 const char *func[AST_MAX_REENTRANCY];
34 pthread_t thread[AST_MAX_REENTRANCY];
37 struct ast_bt backtrace[AST_MAX_REENTRANCY];
40 pthread_mutex_t reentr_mutex;
43 @@ -241,6 +249,7 @@ enum ast_lock_type {
44 * on the lock. ast_mark_lock_acquired() will mark it as held by this thread.
46 #if !defined(LOW_MEMORY)
49 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
50 int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt);
51 @@ -248,14 +257,22 @@ void ast_store_lock_info(enum ast_lock_t
52 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
53 int line_num, const char *func, const char *lock_name, void *lock_addr);
54 #endif /* HAVE_BKTR */
56 +void ast_store_lock_info(enum ast_lock_type type, const char *filename,
57 + int line_num, const char *func, const char *lock_name, void *lock_addr);
64 #define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS,BUD)
66 #define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
67 #endif /* HAVE_BKTR */
69 +#define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
71 #endif /* !defined(LOW_MEMORY) */
74 @@ -283,19 +300,27 @@ void ast_mark_lock_failed(void *lock_add
75 * be removed from the current thread's lock info struct.
77 #if !defined(LOW_MEMORY)
80 void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt);
82 void ast_remove_lock_info(void *lock_addr);
83 #endif /* HAVE_BKTR */
85 +void ast_remove_lock_info(void *lock_addr);
87 void ast_suspend_lock_info(void *lock_addr);
88 void ast_restore_lock_info(void *lock_addr);
92 #define ast_remove_lock_info(ignore,me)
94 #define ast_remove_lock_info(ignore)
95 #endif /* HAVE_BKTR */
97 +#define ast_remove_lock_info(ignore)
99 #define ast_suspend_lock_info(ignore);
100 #define ast_restore_lock_info(ignore);
101 #endif /* !defined(LOW_MEMORY) */
102 --- a/include/asterisk/utils.h
103 +++ b/include/asterisk/utils.h
106 #include "asterisk/network.h"
109 #include <execinfo.h>
111 #include <time.h> /* we want to override localtime_r */
114 @@ -514,13 +516,17 @@ extern void *_ast_mem_backtrace_buffer[_
115 * Ok, this sucks. But if we're already out of mem, we don't
116 * want the logger to create infinite recursion (and a crash).
119 #define MALLOC_FAILURE_MSG \
121 if (backtrace(_ast_mem_backtrace_buffer, _AST_MEM_BACKTRACE_BUFLEN) < _AST_MEM_BACKTRACE_BUFLEN) { \
122 ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file); \
127 +#define MALLOC_FAILURE_MSG \
128 + ast_log(LOG_ERROR, "Memory Allocation Failure (compiled without backtrace support)");
131 * \brief A wrapper for malloc()