aboutsummaryrefslogtreecommitdiffstats
path: root/loader.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-05 22:11:43 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-05 22:11:43 +0000
commit97236cfc3232271c35e2abcf6884267e7495210f (patch)
tree32532d88234e6b8061d225229df28034faa45d2a /loader.c
parent855799ac773c6e205fc33676ff24c19c73500169 (diff)
add support for 'early loading' modules, so that nearly all configuration files can be read from Realtime storage
add warning for when file mapping is found but the engine is not available add warning for trying to map 'logger.conf', since it cannot be reliably mapped git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6034 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'loader.c')
-rwxr-xr-xloader.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/loader.c b/loader.c
index 012491cc1..ec8585190 100755
--- a/loader.c
+++ b/loader.c
@@ -450,35 +450,53 @@ static const char *loadorder[] =
NULL,
};
-int load_modules()
+int load_modules(const int preload_only)
{
struct ast_config *cfg;
struct ast_variable *v;
char tmp[80];
- if (option_verbose)
- ast_verbose( "Asterisk Dynamic Loader Starting:\n");
+
+ if (option_verbose) {
+ if (preload_only)
+ ast_verbose("Asterisk Dynamic Loader loading preload modules:\n");
+ else
+ ast_verbose("Asterisk Dynamic Loader Starting:\n");
+ }
+
cfg = ast_config_load(AST_MODULE_CONFIG);
if (cfg) {
+ int doload;
+
/* Load explicitly defined modules */
- v = ast_variable_browse(cfg, "modules");
- while(v) {
- if (!strcasecmp(v->name, "load")) {
+ for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
+ doload = 0;
+
+ if (preload_only)
+ doload = !strcasecmp(v->name, "preload");
+ else
+ doload = !strcasecmp(v->name, "load");
+
+ if (doload) {
if (option_debug && !option_verbose)
ast_log(LOG_DEBUG, "Loading module %s\n", v->value);
if (option_verbose) {
- ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp)));
+ ast_verbose(VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp)));
fflush(stdout);
}
if (__load_resource(v->value, cfg)) {
ast_log(LOG_WARNING, "Loading module %s failed!\n", v->value);
- if (cfg)
- ast_config_destroy(cfg);
+ ast_config_destroy(cfg);
return -1;
}
}
- v=v->next;
}
}
+
+ if (preload_only) {
+ ast_config_destroy(cfg);
+ return 0;
+ }
+
if (!cfg || ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
/* Load all modules */
DIR *mods;