asterisk-13.x: update source and fix build with musl
[feed/telephony.git] / net / asterisk-13.x / patches / 004-ifdef-missing-execinfo.patch
1 Index: asterisk-13.4.0/include/asterisk/lock.h
2 ===================================================================
3 --- asterisk-13.4.0.orig/include/asterisk/lock.h
4 +++ asterisk-13.4.0/include/asterisk/lock.h
5 @@ -51,9 +51,11 @@
6 #include <pthread.h>
7 #include <time.h>
8 #include <sys/param.h>
9 +#ifndef __UCLIBC__
10 #ifdef HAVE_BKTR
11 #include <execinfo.h>
12 #endif
13 +#endif
14
15 #ifndef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
16 #include "asterisk/time.h"
17 @@ -86,11 +88,15 @@
18 #define __AST_RWLOCK_INIT_VALUE {0}
19 #endif /* HAVE_PTHREAD_RWLOCK_INITIALIZER */
20
21 +#ifndef __UCLIBC__
22 #ifdef HAVE_BKTR
23 #define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, {{{ 0 }}}, PTHREAD_MUTEX_INIT_VALUE }
24 #else
25 #define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, PTHREAD_MUTEX_INIT_VALUE }
26 #endif
27 +#else
28 +#define AST_LOCK_TRACK_INIT_VALUE { { NULL }, { 0 }, 0, { NULL }, { 0 }, PTHREAD_MUTEX_INIT_VALUE }
29 +#endif
30
31 #define AST_MUTEX_INIT_VALUE { PTHREAD_MUTEX_INIT_VALUE, NULL, 1 }
32 #define AST_MUTEX_INIT_VALUE_NOTRACKING { PTHREAD_MUTEX_INIT_VALUE, NULL, 0 }
33 @@ -114,9 +120,11 @@ struct ast_lock_track {
34 int reentrancy;
35 const char *func[AST_MAX_REENTRANCY];
36 pthread_t thread[AST_MAX_REENTRANCY];
37 +#ifndef __UCLIBC__
38 #ifdef HAVE_BKTR
39 struct ast_bt backtrace[AST_MAX_REENTRANCY];
40 #endif
41 +#endif
42 pthread_mutex_t reentr_mutex;
43 };
44
45 @@ -241,6 +249,7 @@ enum ast_lock_type {
46 * on the lock. ast_mark_lock_acquired() will mark it as held by this thread.
47 */
48 #if !defined(LOW_MEMORY)
49 +#ifndef HAVE_BKTR
50 #ifdef HAVE_BKTR
51 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
52 int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt);
53 @@ -248,14 +257,22 @@ void ast_store_lock_info(enum ast_lock_t
54 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
55 int line_num, const char *func, const char *lock_name, void *lock_addr);
56 #endif /* HAVE_BKTR */
57 +#else
58 +void ast_store_lock_info(enum ast_lock_type type, const char *filename,
59 + int line_num, const char *func, const char *lock_name, void *lock_addr);
60 +#endif
61
62 #else
63
64 +#ifndef __UCLIBC__
65 #ifdef HAVE_BKTR
66 #define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS,BUD)
67 #else
68 #define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
69 #endif /* HAVE_BKTR */
70 +#else
71 +#define ast_store_lock_info(I,DONT,CARE,ABOUT,THE,PARAMETERS)
72 +#endif
73 #endif /* !defined(LOW_MEMORY) */
74
75 /*!
76 @@ -283,19 +300,27 @@ void ast_mark_lock_failed(void *lock_add
77 * be removed from the current thread's lock info struct.
78 */
79 #if !defined(LOW_MEMORY)
80 +#ifndef __UCLIBC__
81 #ifdef HAVE_BKTR
82 void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt);
83 #else
84 void ast_remove_lock_info(void *lock_addr);
85 #endif /* HAVE_BKTR */
86 +#else
87 +void ast_remove_lock_info(void *lock_addr);
88 +#endif
89 void ast_suspend_lock_info(void *lock_addr);
90 void ast_restore_lock_info(void *lock_addr);
91 #else
92 +#ifndef __UCLIBC
93 #ifdef HAVE_BKTR
94 #define ast_remove_lock_info(ignore,me)
95 #else
96 #define ast_remove_lock_info(ignore)
97 #endif /* HAVE_BKTR */
98 +#else
99 +#define ast_remove_lock_info(ignore)
100 +#endif
101 #define ast_suspend_lock_info(ignore);
102 #define ast_restore_lock_info(ignore);
103 #endif /* !defined(LOW_MEMORY) */