summaryrefslogtreecommitdiff
path: root/main/logger.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2018-02-16 22:11:42 -0500
committerCorey Farrell <git@cfware.com>2018-03-14 05:20:12 -0400
commit572a508ef2ae7cd86e0ffd8ad6d1c5997e988c26 (patch)
treea0dcfa18f8a4a9d3e87eac3b2a7df33ac2fbcad6 /main/logger.c
parentfee929c8acd788a77982b537953bf4053242057e (diff)
loader: Convert reload_classes to built-in modules.
* acl (named_acl.c) * cdr * cel * ccss * dnsmgr * dsp * enum * extconfig (config.c) * features * http * indications * logger * manager * plc * sounds * udptl These modules are now loaded at appropriate time by the module loader. Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so the module loader will abort startup on failure of these modules. Some of these modules are still initialized or shutdown from outside the module loader. logger.c is initialized very early and shutdown very late, manager.c is initialized by the module loader but is shutdown by the Asterisk core (too much uses it without holding references). Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/main/logger.c b/main/logger.c
index 6060b3c4d..46d61ed33 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -49,6 +49,7 @@
#include <fcntl.h>
#include "asterisk/_private.h"
+#include "asterisk/module.h"
#include "asterisk/paths.h" /* use ast_config_AST_LOG_DIR */
#include "asterisk/logger.h"
#include "asterisk/lock.h"
@@ -1125,16 +1126,6 @@ static int reload_logger(int rotate, const char *altconf)
return res;
}
-/*! \brief Reload the logger module without rotating log files (also used from loader.c during
- a full Asterisk reload) */
-int logger_reload(void)
-{
- if (reload_logger(0, NULL)) {
- return RESULT_FAILURE;
- }
- return RESULT_SUCCESS;
-}
-
static char *handle_logger_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {
@@ -2369,3 +2360,27 @@ int ast_logger_get_queue_limit(void)
{
return logger_queue_limit;
}
+
+static int reload_module(void)
+{
+ return reload_logger(0, NULL);
+}
+
+static int unload_module(void)
+{
+ return 0;
+}
+
+static int load_module(void)
+{
+ return AST_MODULE_LOAD_SUCCESS;
+}
+
+/* Logger is initialized separate from the module loader, only reload_module does anything. */
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Logger",
+ .support_level = AST_MODULE_SUPPORT_CORE,
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload_module,
+ .load_pri = 0,
+);