31 #define ASTMM_LIBC ASTMM_IGNORE 45 #ifndef DEBUG_CHAOS_ALLOC_CHANCE 46 #define DEBUG_CHAOS_ALLOC_CHANCE 100000 49 #ifndef DEBUG_CHAOS_ENABLE 50 #define DEBUG_CHAOS_ENABLE 1 52 #define DEBUG_CHAOS_RETURN(CHANCE, FAILURE) \ 54 if ((DEBUG_CHAOS_ENABLE) && (ast_random() % CHANCE == 0)) { \ 59 #define DEBUG_CHAOS_RETURN(c,f) 62 #if defined(STANDALONE) || defined(STANDALONE2) 63 #define ast_log_safe ast_log 66 #if defined(MALLOC_DEBUG) && !defined(STANDALONE) && !defined(STANDALONE2) 67 #define __AST_DEBUG_MALLOC 70 #define MALLOC_FAILURE_MSG \ 71 ast_log_safe(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file) 73 #if defined(__AST_DEBUG_MALLOC) 90 #define SOME_PRIME 1567 102 #define FENCE_MAGIC 0xfeedbabe 103 #define FREED_MAGIC 0xdeaddead 104 #define MALLOC_FILLER 0x55 114 enum func_type which;
134 unsigned char data[0] __attribute__((aligned));
138 static struct ast_region *regions[SOME_PRIME];
141 #define FREED_MAX_COUNT 1500 144 #define MINNOWS_MAX_SIZE 50 146 struct ast_freed_regions {
148 struct ast_region *regions[FREED_MAX_COUNT];
154 static struct ast_freed_regions whales;
156 static struct ast_freed_regions minnows;
162 SUMMARY_BY_LINE = (1 << 0),
164 SUMMARY_BY_FUNC = (1 << 1),
166 SUMMARY_BY_FILE = (1 << 2),
170 static enum summary_opts atexit_summary;
172 static int atexit_list;
174 static int backtrace_enabled;
176 #define HASH(a) (((unsigned long)(a)) % ARRAY_LEN(regions)) 182 #define astmm_log(...) \ 184 fprintf(stderr, __VA_ARGS__); \ 186 fprintf(mmlog, __VA_ARGS__); \ 194 struct ast_vector_string *strings;
202 ast_cli(a->
fd,
"Memory allocation backtrace:\n");
204 astmm_log(
"Memory allocation backtrace:\n");
224 static void my_do_crash(
void)
235 static void *__ast_alloc_region(
size_t size,
const enum func_type which,
const char *
file,
int lineno,
const char *func,
unsigned int cache)
237 struct ast_region *reg;
243 if (!(reg =
malloc(size +
sizeof(*reg) +
sizeof(*fence)))) {
244 astmm_log(
"Memory Allocation Failure - '%d' bytes at %s %s() line %d\n",
245 (
int) size,
file, func, lineno);
251 reg->lineno = lineno;
264 fence = (
unsigned int *) (reg->data -
sizeof(*fence));
265 *fence = FENCE_MAGIC;
268 fence = (
unsigned int *) (reg->data + reg->len);
271 hash = HASH(reg->data);
288 static void region_data_wipe(
struct ast_region *reg)
297 end = reg->data + reg->len;
298 for (pos = ®->fence; (
void *) pos <= end; ++pos) {
311 static void region_data_check(
struct ast_region *reg)
320 end = reg->data + reg->len;
321 for (pos = ®->fence; (
void *) pos <= end; ++pos) {
322 if (*pos != FREED_MAGIC) {
323 astmm_log(
"WARNING: Memory corrupted after free of %p allocated at %s %s() line %d\n",
324 reg->data, reg->file, reg->func, reg->lineno);
325 print_backtrace(reg->bt,
NULL);
340 static void freed_regions_flush(
struct ast_freed_regions *freed)
343 struct ast_region *old;
346 for (idx = 0; idx <
ARRAY_LEN(freed->regions); ++idx) {
347 old = freed->regions[idx];
348 freed->regions[idx] =
NULL;
350 region_data_check(old);
367 static void region_free(
struct ast_freed_regions *freed,
struct ast_region *reg)
369 struct ast_region *old;
371 region_data_wipe(reg);
374 old = freed->regions[freed->index];
375 freed->regions[freed->index] = reg;
378 if (
ARRAY_LEN(freed->regions) <= freed->index) {
384 region_data_check(old);
399 static struct ast_region *region_remove(
void *ptr)
402 struct ast_region *reg;
403 struct ast_region *prev =
NULL;
409 if (reg->data == ptr) {
432 static void region_check_fences(
struct ast_region *reg)
441 fence = (
unsigned int *) (reg->data -
sizeof(*fence));
442 if (*fence != FENCE_MAGIC) {
443 astmm_log(
"WARNING: Low fence violation of %p allocated at %s %s() line %d\n",
444 reg->data, reg->file, reg->func, reg->lineno);
445 print_backtrace(reg->bt,
NULL);
448 fence = (
unsigned int *) (reg->data + reg->len);
450 astmm_log(
"WARNING: High fence violation of %p allocated at %s %s() line %d\n",
451 reg->data, reg->file, reg->func, reg->lineno);
452 print_backtrace(reg->bt,
NULL);
463 static void regions_check_all_fences(
void)
466 struct ast_region *reg;
469 for (idx = 0; idx <
ARRAY_LEN(regions); ++idx) {
471 region_check_fences(reg);
477 void __ast_free(
void *ptr,
const char *
file,
int lineno,
const char *func)
479 struct ast_region *reg;
485 reg = region_remove(ptr);
487 region_check_fences(reg);
489 if (reg->len <= MINNOWS_MAX_SIZE) {
490 region_free(&minnows, reg);
492 region_free(&whales, reg);
500 astmm_log(
"WARNING: Freeing unregistered memory %p by %s %s() line %d\n",
501 ptr,
file, func, lineno);
510 ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC,
file, lineno, func, 0);
512 memset(ptr, 0, size * nmemb);
522 ptr = __ast_alloc_region(size * nmemb, FUNC_CALLOC,
file, lineno, func, 1);
524 memset(ptr, 0, size * nmemb);
534 ptr = __ast_alloc_region(size, FUNC_MALLOC,
file, lineno, func, 0);
537 memset(ptr, MALLOC_FILLER, size);
546 static struct ast_region *region_find(
void *ptr)
549 struct ast_region *reg;
553 if (reg->data == ptr) {
564 struct ast_region *found;
569 found = region_find(ptr);
572 astmm_log(
"WARNING: Realloc of unregistered memory %p by %s %s() line %d\n",
573 ptr,
file, func, lineno);
589 new_mem = __ast_alloc_region(size, FUNC_REALLOC,
file, lineno, func, 0);
594 memcpy(new_mem, ptr, size);
596 memcpy(new_mem, ptr, len);
598 memset(new_mem + len, MALLOC_FILLER, size - len);
603 memset(new_mem, MALLOC_FILLER, size);
616 if ((ptr = __ast_alloc_region(len, FUNC_STRDUP,
file, lineno, func, 0))) {
629 if ((ptr = __ast_alloc_region(len + 1, FUNC_STRNDUP,
file, lineno, func, 0))) {
646 size = vsnprintf(&s, 1, fmt, ap2);
648 ptr = __ast_alloc_region(size + 1, FUNC_ASPRINTF,
file, lineno, func, 0);
654 vsnprintf(ptr, size + 1, fmt, ap);
669 size = vsnprintf(&s, 1, fmt, ap2);
671 ptr = __ast_alloc_region(size + 1, FUNC_VASPRINTF,
file, lineno, func, 0);
676 vsnprintf(ptr, size + 1, fmt, ap);
692 static size_t freed_regions_size(
struct ast_freed_regions *freed)
694 size_t total_len = 0;
696 struct ast_region *old;
698 for (idx = 0; idx <
ARRAY_LEN(freed->regions); ++idx) {
699 old = freed->regions[idx];
701 total_len += old->len;
712 e->
command =
"memory atexit list {on|off}";
714 "Usage: memory atexit list {on|off}\n" 715 " Enable dumping a list of still allocated memory segments at exit.\n";
733 ast_cli(a->
fd,
"The atexit list is: %s\n", atexit_list ?
"On" :
"Off");
744 e->
command =
"memory atexit summary {off|byline|byfunc|byfile}";
746 "Usage: memory atexit summary {off|byline|byfunc|byfile}\n" 747 " Summary of still allocated memory segments at exit options.\n" 748 " off - Disable at exit summary.\n" 749 " byline - Enable at exit summary by file line number.\n" 750 " byfunc - Enable at exit summary by function name.\n" 751 " byfile - Enable at exit summary by file.\n" 753 " Note: byline, byfunc, and byfile are cumulative enables.\n";
764 atexit_summary = SUMMARY_OFF;
765 }
else if (!strcasecmp(a->
argv[3],
"byline")) {
766 atexit_summary |= SUMMARY_BY_LINE;
767 }
else if (!strcasecmp(a->
argv[3],
"byfunc")) {
768 atexit_summary |= SUMMARY_BY_FUNC;
769 }
else if (!strcasecmp(a->
argv[3],
"byfile")) {
770 atexit_summary |= SUMMARY_BY_FILE;
775 if (atexit_summary) {
777 if (atexit_summary & SUMMARY_BY_LINE) {
778 strcat(buf,
"byline");
780 if (atexit_summary & SUMMARY_BY_FUNC) {
784 strcat(buf,
"byfunc");
786 if (atexit_summary & SUMMARY_BY_FILE) {
790 strcat(buf,
"byfile");
795 ast_cli(a->
fd,
"The atexit summary is: %s\n", buf);
814 static void print_memory_show_common_stats(
int fd,
815 unsigned int whales_len,
816 unsigned int minnows_len,
817 unsigned int total_len,
818 unsigned int selected_len,
819 unsigned int cache_len,
823 ast_cli(fd,
"%10u bytes allocated (%u in caches) in %u selected allocations\n\n",
824 selected_len, cache_len, count);
826 ast_cli(fd,
"%10u bytes allocated in %u selected allocations\n\n",
827 selected_len, count);
830 ast_cli(fd,
"%10u bytes in all allocations\n", total_len);
831 ast_cli(fd,
"%10u bytes in deferred free large allocations\n", whales_len);
832 ast_cli(fd,
"%10u bytes in deferred free small allocations\n", minnows_len);
833 ast_cli(fd,
"%10u bytes in deferred free allocations\n",
834 whales_len + minnows_len);
835 ast_cli(fd,
"%10u bytes in all allocations and deferred free allocations\n",
836 total_len + whales_len + minnows_len);
841 const char *fn =
NULL;
842 struct ast_region *reg;
844 unsigned int whales_len;
845 unsigned int minnows_len;
846 unsigned int total_len = 0;
847 unsigned int selected_len = 0;
848 unsigned int cache_len = 0;
849 unsigned int count = 0;
853 e->
command =
"memory show allocations";
855 "Usage: memory show allocations [<file>|anomalies]\n" 856 " Dumps a list of segments of allocated memory.\n" 857 " Defaults to listing all memory allocations.\n" 858 " <file> - Restricts output to memory allocated by the file.\n" 859 " anomalies - Only check for fence violations.\n";
867 }
else if (a->
argc != 3) {
872 if (fn && (!strcasecmp(fn,
"anomalies") || !strcasecmp(fn,
"anomolies"))) {
873 regions_check_all_fences();
874 ast_cli(a->
fd,
"Anomaly check complete.\n");
879 for (idx = 0; idx <
ARRAY_LEN(regions); ++idx) {
881 total_len += reg->len;
882 if (fn && strcasecmp(fn, reg->file)) {
886 region_check_fences(reg);
888 ast_cli(a->
fd,
"%10u bytes allocated%s by %20s() line %5u of %s\n",
889 (
unsigned int) reg->len, reg->cache ?
" (cache)" :
"",
890 reg->func, reg->lineno, reg->file);
892 print_backtrace(reg->bt, a);
895 selected_len += reg->len;
897 cache_len += reg->len;
903 whales_len = freed_regions_size(&whales);
904 minnows_len = freed_regions_size(&minnows);
907 print_memory_show_common_stats(a->
fd,
908 whales_len, minnows_len, total_len,
909 selected_len, cache_len, count);
916 #define my_max(a, b) ((a) >= (b) ? (a) : (b)) 918 const char *fn =
NULL;
921 struct ast_region *reg;
922 unsigned int whales_len;
923 unsigned int minnows_len;
924 unsigned int total_len = 0;
925 unsigned int selected_len = 0;
926 unsigned int cache_len = 0;
927 unsigned int count = 0;
928 struct file_summary {
929 struct file_summary *next;
931 unsigned int cache_len;
934 char name[my_max(
sizeof(reg->file),
sizeof(reg->func))];
935 } *list =
NULL, *cur, **prev;
939 e->
command =
"memory show summary";
941 "Usage: memory show summary [<file>]\n" 942 " Summarizes heap memory allocations by file, or optionally\n" 943 " by line if a file is specified.\n";
951 }
else if (a->
argc != 3) {
956 for (idx = 0; idx <
ARRAY_LEN(regions); ++idx) {
958 total_len += reg->len;
960 if (strcasecmp(fn, reg->file)) {
965 for (prev = &list; (cur = *prev); prev = &cur->next) {
966 cmp = strcmp(cur->name, reg->func);
975 cmp = cur->lineno - reg->lineno;
987 for (prev = &list; (cur = *prev); prev = &cur->next) {
988 cmp = strcmp(cur->name, reg->file);
1002 memset(cur, 0,
sizeof(*cur));
1003 cur->lineno = reg->lineno;
1004 ast_copy_string(cur->name, fn ? reg->func : reg->file,
sizeof(cur->name));
1010 cur->len += reg->len;
1012 cur->cache_len += reg->len;
1018 whales_len = freed_regions_size(&whales);
1019 minnows_len = freed_regions_size(&minnows);
1023 for (cur = list; cur; cur = cur->next) {
1024 selected_len += cur->len;
1025 cache_len += cur->cache_len;
1026 count += cur->count;
1027 if (cur->cache_len) {
1029 ast_cli(a->
fd,
"%10u bytes (%10u cache) in %10u allocations by %20s() line %5u of %s\n",
1030 cur->len, cur->cache_len, cur->count, cur->name, cur->lineno, fn);
1032 ast_cli(a->
fd,
"%10u bytes (%10u cache) in %10u allocations in file %s\n",
1033 cur->len, cur->cache_len, cur->count, cur->name);
1037 ast_cli(a->
fd,
"%10u bytes in %10u allocations by %20s() line %5u of %s\n",
1038 cur->len, cur->count, cur->name, cur->lineno, fn);
1040 ast_cli(a->
fd,
"%10u bytes in %10u allocations in file %s\n",
1041 cur->len, cur->count, cur->name);
1046 print_memory_show_common_stats(a->
fd,
1047 whales_len, minnows_len, total_len,
1048 selected_len, cache_len, count);
1057 e->
command =
"memory backtrace {on|off}";
1059 "Usage: memory backtrace {on|off}\n" 1060 " Enable dumping an allocation backtrace with memory diagnostics.\n" 1061 " Note that saving the backtrace data for each allocation\n" 1062 " can be CPU intensive.\n";
1073 backtrace_enabled = 1;
1075 backtrace_enabled = 0;
1080 ast_cli(a->
fd,
"The memory backtrace is: %s\n", backtrace_enabled ?
"On" :
"Off");
1086 AST_CLI_DEFINE(handle_memory_atexit_list,
"Enable memory allocations not freed at exit list."),
1087 AST_CLI_DEFINE(handle_memory_atexit_summary,
"Enable memory allocations not freed at exit summary."),
1088 AST_CLI_DEFINE(handle_memory_show_allocations,
"Display outstanding memory allocations"),
1089 AST_CLI_DEFINE(handle_memory_show_summary,
"Summarize outstanding memory allocations"),
1090 AST_CLI_DEFINE(handle_memory_backtrace,
"Enable dumping an allocation backtrace with memory diagnostics."),
1111 static size_t mm_atexit_hash_list(
struct region_list *
list)
1113 struct ast_region *reg;
1114 size_t total_length;
1118 for (idx = 0; idx <
ARRAY_LEN(regions); ++idx) {
1119 while ((reg = regions[idx])) {
1126 return total_length;
1139 static void mm_atexit_hash_restore(
struct region_list *list)
1141 struct ast_region *reg;
1145 hash = HASH(reg->data);
1147 regions[hash] = reg;
1162 static int mm_atexit_cmp(
struct ast_region *left,
struct ast_region *right)
1169 cmp = strcmp(left->file, right->file);
1175 cmp = left->lineno - right->lineno;
1181 cmp_size = left->len - right->len;
1190 cmp_ptr = left->data - right->data;
1211 static void mm_atexit_list_merge(
struct region_list *list,
struct region_list *sub1,
struct region_list *sub2)
1213 struct ast_region *reg;
1248 static void mm_atexit_list_split(
struct region_list *list,
struct region_list
sub[],
size_t num_lists,
size_t size,
size_t *remaining)
1252 for (idx = 0; idx < num_lists; ++idx) {
1255 if (*remaining < size) {
1264 for (count = size; count--;) {
1265 struct ast_region *reg;
1282 static void mm_atexit_list_sort(
struct region_list *list,
size_t length)
1287 struct region_list sub[2] = {
1303 mm_atexit_list_split(list, sub,
ARRAY_LEN(sub), size, &remaining);
1304 mm_atexit_list_merge(&merged, &sub[0], &sub[1]);
1326 static void mm_atexit_regions_list(
struct region_list *alloced)
1328 struct ast_region *reg;
1331 astmm_log(
"%s %s() line %u: %u bytes%s at %p\n",
1332 reg->file, reg->func, reg->lineno,
1333 (
unsigned int) reg->len, reg->cache ?
" (cache)" :
"", reg->data);
1345 static void mm_atexit_regions_summary(
struct region_list *alloced)
1347 struct ast_region *reg;
1348 struct ast_region *next;
1352 unsigned int cache_len;
1353 } by_line, by_func, by_file,
total;
1357 by_line.cache_len = 0;
1361 by_func.cache_len = 0;
1365 by_file.cache_len = 0;
1369 total.cache_len = 0;
1375 by_line.len += reg->len;
1377 by_line.cache_len += reg->len;
1379 if (next && !strcmp(reg->file, next->file) && reg->lineno == next->lineno) {
1382 if (atexit_summary & SUMMARY_BY_LINE) {
1383 if (by_line.cache_len) {
1384 astmm_log(
"%10u bytes (%u in caches) in %u allocations. %s %s() line %u\n",
1385 by_line.len, by_line.cache_len, by_line.count, reg->file, reg->func, reg->lineno);
1387 astmm_log(
"%10u bytes in %5u allocations. %s %s() line %u\n",
1388 by_line.len, by_line.count, reg->file, reg->func, reg->lineno);
1392 by_func.count += by_line.count;
1393 by_func.len += by_line.len;
1394 by_func.cache_len += by_line.cache_len;
1397 by_line.cache_len = 0;
1398 if (next && !strcmp(reg->file, next->file) && !strcmp(reg->func, next->func)) {
1401 if (atexit_summary & SUMMARY_BY_FUNC) {
1402 if (by_func.cache_len) {
1403 astmm_log(
"%10u bytes (%u in caches) in %u allocations. %s %s()\n",
1404 by_func.len, by_func.cache_len, by_func.count, reg->file, reg->func);
1406 astmm_log(
"%10u bytes in %5u allocations. %s %s()\n",
1407 by_func.len, by_func.count, reg->file, reg->func);
1411 by_file.count += by_func.count;
1412 by_file.len += by_func.len;
1413 by_file.cache_len += by_func.cache_len;
1416 by_func.cache_len = 0;
1417 if (next && !strcmp(reg->file, next->file)) {
1420 if (atexit_summary & SUMMARY_BY_FILE) {
1421 if (by_file.cache_len) {
1422 astmm_log(
"%10u bytes (%u in caches) in %u allocations. %s\n",
1423 by_file.len, by_file.cache_len, by_file.count, reg->file);
1425 astmm_log(
"%10u bytes in %5u allocations. %s\n",
1426 by_file.len, by_file.count, reg->file);
1430 total.count += by_file.count;
1431 total.len += by_file.len;
1432 total.cache_len += by_file.cache_len;
1435 by_file.cache_len = 0;
1438 if (total.cache_len) {
1439 astmm_log(
"%u bytes (%u in caches) in %u allocations.\n",
1440 total.len, total.cache_len, total.count);
1442 astmm_log(
"%u bytes in %u allocations.\n", total.len, total.count);
1454 static void mm_atexit_dump(
void)
1459 length = mm_atexit_hash_list(&alloced_atexit);
1462 astmm_log(
"Exiting with all memory freed.\n");
1466 mm_atexit_list_sort(&alloced_atexit, length);
1468 astmm_log(
"Exiting with the following memory not freed:\n");
1470 mm_atexit_regions_list(&alloced_atexit);
1472 if (atexit_summary) {
1473 mm_atexit_regions_summary(&alloced_atexit);
1482 mm_atexit_hash_restore(&alloced_atexit);
1489 static void mm_atexit_final(
void)
1494 if (atexit_list || atexit_summary) {
1495 fprintf(stderr,
"Waiting 10 seconds to let other threads die.\n");
1499 regions_check_all_fences();
1502 freed_regions_flush(&whales);
1503 freed_regions_flush(&minnows);
1506 if (atexit_list || atexit_summary) {
1522 atexit(mm_atexit_final);
1529 static void mm_atexit_ast(
void)
1542 ast_verb(1,
"Asterisk Malloc Debugger Started (see %s))\n", filename);
1544 mmlog = fopen(filename,
"a+");
1546 fprintf(mmlog,
"%ld - New session\n", (
long) time(
NULL));
1549 ast_log(
LOG_ERROR,
"Could not open malloc debug log file: %s\n", filename);
1569 return calloc(nmemb, size);
1576 return calloc(nmemb, size);
1619 va_start(ap, format);
1686 char *newstr =
NULL;
1700 char *newstr =
NULL;
1717 va_start(ap, format);
1758 return calloc(nmemb, size);
#define AST_CLI_DEFINE(fn, txt,...)
void * __ast_malloc(size_t size, const char *file, int lineno, const char *func)
char * __ast_repl_strdup(const char *s, const char *file, int lineno, const char *func)
void __ast_free(void *ptr, const char *file, int lineno, const char *func)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
void * __ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
Asterisk backtrace generation.
String manipulation functions.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ast_bt_free_symbols(string_vector)
Time-related functions and macros.
size_t strnlen(const char *, size_t)
descriptor for a cli entry.
char * __ast_repl_strndup(const char *s, size_t n, const char *file, int lineno, const char *func)
#define ast_bt_get_symbols(addresses, num_frames)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static void put_unaligned_uint32(void *p, unsigned int datum)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
void * ast_std_realloc(void *ptr, size_t size)
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ast_mutex_lock(a)
#define ast_bt_destroy(bt)
char * strndup(const char *, size_t)
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void ast_cli(int fd, const char *fmt,...)
static void * __ast_repl_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
#define ast_verb(level,...)
int vasprintf(char **strp, const char *fmt, va_list ap)
void * __ast_repl_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
#define ast_strlen_zero(foo)
#define DEBUG_CHAOS_RETURN(c, f)
DEBUG_CHAOS returns failure randomly.
void load_astmm_phase_1(void)
Initialize malloc debug phase 1.
void ast_free_ptr(void *ptr)
free() wrapper
void * __ast_repl_malloc(size_t size, const char *file, int lineno, const char *func)
Handle unaligned data access.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Asterisk file paths, configured in asterisk.conf.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
static unsigned int get_unaligned_uint32(const void *p)
void load_astmm_phase_2(void)
Initialize malloc debug phase 2.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
char * __ast_strdup(const char *s, const char *file, int lineno, const char *func)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void * ast_std_malloc(size_t size)
int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format,...)
char * __ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func)
const char * ast_config_AST_LOG_DIR
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
void DO_CRASH_NORETURN ast_do_crash(void)
Force a crash if DO_CRASH is defined.
int __ast_repl_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func)
Prototypes for public functions only of internal interest,.
void * __ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func)
void * addresses[AST_MAX_BT_FRAMES]
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
void * ast_std_calloc(size_t nmemb, size_t size)
Support for logging to various files, console and syslog Configuration in file logger.conf.
struct ao2_container * cache
#define AST_MUTEX_DEFINE_STATIC_NOTRACKING(mutex)
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
int __ast_repl_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format,...)
struct stasis_forward * sub
int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func)
void * __ast_repl_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func)
void ast_std_free(void *ptr)
static snd_pcm_format_t format
struct ast_cli_entry::@250 list
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define MALLOC_FAILURE_MSG
#define ast_mutex_unlock(a)
#define AST_LIST_APPEND_LIST(head, list, field)
Appends a whole list to the tail of a list.