diff options
author | Michael L. Young <elgueromexicano@gmail.com> | 2013-02-19 17:17:10 +0000 |
---|---|---|
committer | Michael L. Young <elgueromexicano@gmail.com> | 2013-02-19 17:17:10 +0000 |
commit | d1f8e338b0713975e5b42654f9e771acffb713d4 (patch) | |
tree | 5c966886ed4b57e1ba31837388e49dc9a6ec24bb /main | |
parent | f2774606707582097e24054659f0d77c162eded7 (diff) |
Add The Status Of A Module To The Output Of "CLI> module show"
When a module's configuration is not loadable, we still load the module but it
is not in a running state. When trying to troubleshoot, let's say, why
chan_motif is ignoring inbound XMPP traffic, there is no way to indicate that a
loaded module is not currently running.
(closes issue ASTERISK-21108)
Reported by: Rusty Newton
Tested by: Michael L. Young
Patches:
asterisk-21108_add_status-v2.diff Michael L. Young (license 5026)
Review: https://reviewboard.asterisk.org/r/2331/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/cli.c | 10 | ||||
-rw-r--r-- | main/loader.c | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/main/cli.c b/main/cli.c index 818ce757f..b4e2c369c 100644 --- a/main/cli.c +++ b/main/cli.c @@ -651,17 +651,17 @@ static char *handle_unload(struct ast_cli_entry *e, int cmd, struct ast_cli_args return CLI_SUCCESS; } -#define MODLIST_FORMAT "%-30s %-40.40s %-10d\n" -#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n" +#define MODLIST_FORMAT "%-30s %-40.40s %-10d %s\n" +#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %s\n" AST_MUTEX_DEFINE_STATIC(climodentrylock); static int climodentryfd = -1; -static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like) +static int modlist_modentry(const char *module, const char *description, int usecnt, const char *status, const char *like) { /* Comparing the like with the module */ if (strcasestr(module, like) ) { - ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt); + ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt, status); return 1; } return 0; @@ -788,7 +788,7 @@ static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_arg ast_mutex_lock(&climodentrylock); climodentryfd = a->fd; /* global, protected by climodentrylock */ - ast_cli(a->fd, MODLIST_FORMAT2, "Module", "Description", "Use Count"); + ast_cli(a->fd, MODLIST_FORMAT2, "Module", "Description", "Use Count", "Status"); ast_cli(a->fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like)); climodentryfd = -1; ast_mutex_unlock(&climodentrylock); diff --git a/main/loader.c b/main/loader.c index 7ad515f8a..5befafb55 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1240,7 +1240,7 @@ void ast_update_use_count(void) AST_LIST_UNLOCK(&updaters); } -int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like), +int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like), const char *like) { struct ast_module *cur; @@ -1251,7 +1251,8 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr unlock = 0; AST_LIST_TRAVERSE(&module_list, cur, entry) { - total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, like); + total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, + cur->flags.running ? "Running" : "Not Running", like); } if (unlock) |