diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-18 19:54:18 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-18 19:54:18 +0000 |
commit | 5aacb6a82d4cf625774fa1ea39ca193a3be73b35 (patch) | |
tree | cf63baa167f81c95d3dbf417f83681851decad80 /main/astmm.c | |
parent | 4de5810a0530bca0665eadcfb06ef06fd2e86758 (diff) |
merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astmm.c')
-rw-r--r-- | main/astmm.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/main/astmm.c b/main/astmm.c index b3b68dc06..990fe26f0 100644 --- a/main/astmm.c +++ b/main/astmm.c @@ -302,7 +302,7 @@ static int handle_show_memory(int fd, int argc, char *argv[]) unsigned int count = 0; unsigned int *fence; - if (argc > 3) + if (argc > 3) fn = argv[3]; ast_mutex_lock(&showmemorylock); @@ -395,31 +395,40 @@ static int handle_show_memory_summary(int fd, int argc, char *argv[]) } static char show_memory_help[] = -"Usage: show memory allocations [<file>]\n" +"Usage: memory show allocations [<file>]\n" " Dumps a list of all segments of allocated memory, optionally\n" "limited to those from a specific file\n"; static char show_memory_summary_help[] = -"Usage: show memory summary [<file>]\n" +"Usage: memory show summary [<file>]\n" " Summarizes heap memory allocations by file, or optionally\n" "by function, if a file is specified\n"; -static struct ast_cli_entry show_memory_allocations_cli = - { { "show", "memory", "allocations", NULL }, +static struct ast_cli_entry cli_show_memory_allocations_deprecated = { + { "show", "memory", "allocations", NULL }, + handle_show_memory, NULL, + NULL }; + +static struct ast_cli_entry cli_show_memory_summary_deprecated = { + { "show", "memory", "summary", NULL }, + handle_show_memory_summary, NULL, + NULL }; + +static struct ast_cli_entry cli_memory[] = { + { { "memory", "show", "allocations", NULL }, handle_show_memory, "Display outstanding memory allocations", - show_memory_help }; + show_memory_help, NULL, &cli_show_memory_allocations }, -static struct ast_cli_entry show_memory_summary_cli = - { { "show", "memory", "summary", NULL }, + { { "memory", "show", "summary", NULL }, handle_show_memory_summary, "Summarize outstanding memory allocations", - show_memory_summary_help }; + show_memory_summary_help, NULL, &cli_show_memory_summary }, +}; void __ast_mm_init(void) { char filename[PATH_MAX]; - ast_cli_register(&show_memory_allocations_cli); - ast_cli_register(&show_memory_summary_cli); + ast_cli_register_multiple(cli_memory, sizeof(cli_memory) / sizeof(struct ast_cli_entry)); snprintf(filename, sizeof(filename), "%s/mmlog", (char *)ast_config_AST_LOG_DIR); |