diff options
-rwxr-xr-x | build_tools/list_valid_installed_externals | 3 | ||||
-rwxr-xr-x | contrib/scripts/install_prereq | 2 | ||||
-rw-r--r-- | include/asterisk/linkedlists.h | 2 | ||||
-rw-r--r-- | main/asterisk.c | 30 | ||||
-rw-r--r-- | main/editline/el.h | 6 | ||||
-rw-r--r-- | main/loader.c | 32 |
6 files changed, 41 insertions, 34 deletions
diff --git a/build_tools/list_valid_installed_externals b/build_tools/list_valid_installed_externals index c37102208..862447a64 100755 --- a/build_tools/list_valid_installed_externals +++ b/build_tools/list_valid_installed_externals @@ -19,10 +19,7 @@ EOF XMLSTARLET=`getvar XMLSTARLET` ASTMODDIR=`getvar ASTMODDIR` -cache_dir=`getvar EXTERNALS_CACHE_DIR` -DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT` HOST_CPU=`getvar HOST_CPU` -INSTALL=`getvar INSTALL` tmpdir=$(mktemp -d) if [[ -z "${tmpdir}" ]] ; then diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index badd59f6c..86b9a4d7c 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -46,7 +46,7 @@ PACKAGES_FBSD="$PACKAGES_FBSD sqlite3 libxslt jansson e2fsprogs-libuuid gsm libs KVERS=`uname -r` -JANSSON_VER=2.4 +JANSSON_VER=2.10 case "$1" in test) diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 8715cf1ad..5f50c7535 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -854,7 +854,7 @@ struct { \ */ #define AST_LIST_REMOVE(head, elm, field) \ ({ \ - __typeof(elm) __elm = (elm); \ + typeof(elm) __elm = (elm); \ if (__elm) { \ if ((head)->first == __elm) { \ (head)->first = __elm->field.next; \ diff --git a/main/asterisk.c b/main/asterisk.c index 1bc0324e1..0214159d6 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -4545,20 +4545,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou check_init(ast_device_state_engine_init(), "Device State Engine"); check_init(ast_presence_state_engine_init(), "Presence State Engine"); check_init(ast_dns_system_resolver_init(), "Default DNS resolver"); - check_init(load_modules(1), "Module Preload"); - check_init(ast_features_init(), "Call Features"); - check_init(dnsmgr_init(), "DNS manager"); check_init(ast_security_stasis_init(), "Security Stasis Topic and Events"); - check_init(ast_named_acl_init(), "Named ACL system"); - - ast_http_init(); /* Start the HTTP server, if needed */ - - check_init(ast_indications_init(), "Indication Tone Handling"); - check_init(ast_cdr_engine_init(), "CDR Engine"); - - ast_dsp_init(); - ast_udptl_init(); - check_init(ast_image_init(), "Image"); check_init(ast_file_init(), "Generic File Format Support"); check_init(load_pbx(), "load_pbx"); @@ -4569,10 +4556,27 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou check_init(load_pbx_app(), "PBX Application Support"); check_init(load_pbx_hangup_handler(), "PBX Hangup Handler Support"); check_init(ast_local_init(), "Local Proxy Channel Driver"); + + /* We should avoid most config loads before this point as they can't use realtime. */ + check_init(load_modules(1), "Module Preload"); + + /* Initialize core modules that have config files. These should be converted to + * built-in modules with load priority after realtime, that way users will not + * need to 'preload' realtime modules. */ + check_init(ast_features_init(), "Call Features"); + check_init(dnsmgr_init(), "DNS manager"); + check_init(ast_named_acl_init(), "Named ACL system"); + ast_http_init(); + check_init(ast_indications_init(), "Indication Tone Handling"); + check_init(ast_cdr_engine_init(), "CDR Engine"); + ast_dsp_init(); + ast_udptl_init(); check_init(ast_cel_engine_init(), "CEL Engine"); check_init(init_manager(), "Asterisk Manager Interface"); check_init(ast_enum_init(), "ENUM Support"); check_init(ast_cc_init(), "Call Completion Supplementary Services"); + + /* Load remaining modules */ check_init(load_modules(0), "Module"); /* diff --git a/main/editline/el.h b/main/editline/el.h index 641081e87..386d84cce 100644 --- a/main/editline/el.h +++ b/main/editline/el.h @@ -55,9 +55,9 @@ #define EL_BUFSIZ 1024 /* Maximum line size */ -#define HANDLE_SIGNALS 1<<0 -#define NO_TTY 1<<1 -#define EDIT_DISABLED 1<<2 +#define HANDLE_SIGNALS 0x01 +#define NO_TTY 0x02 +#define EDIT_DISABLED 0x04 typedef int bool_t; /* True or not */ diff --git a/main/loader.c b/main/loader.c index da508f3de..159014e72 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1394,7 +1394,7 @@ static enum ast_module_load_result start_resource(struct ast_module *mod) } AST_VECTOR_FREE(&missing); - return AST_MODULE_LOAD_FAILURE; + return AST_MODULE_LOAD_DECLINE; } if (!ast_fully_booted) { @@ -1580,6 +1580,7 @@ static int start_resource_list(struct module_vector *resources, int *mod_count) struct ast_module *mod = AST_VECTOR_REMOVE(resources, 0, 1); enum ast_module_load_result lres; +retry_load: lres = start_resource_attempt(mod, mod_count); if (lres == AST_MODULE_LOAD_SUCCESS) { /* No missing dependencies, successful. */ @@ -1598,13 +1599,18 @@ static int start_resource_list(struct module_vector *resources, int *mod_count) res = module_deps_missing_recursive(mod, &missingdeps); if (res) { - break; + AST_VECTOR_RESET(&missingdeps, AST_VECTOR_ELEM_CLEANUP_NOOP); + ast_log(LOG_ERROR, "Failed to resolve dependencies for %s\n", ast_module_name(mod)); + mod->flags.declined = 1; + + continue; } if (!AST_VECTOR_SIZE(&missingdeps)) { - ast_log(LOG_WARNING, "%s isn't missing any dependencies but still didn't start\n", - ast_module_name(mod)); - /* Dependencies were met but the module failed to start. */ + ast_log(LOG_WARNING, "%s load function returned an invalid result. " + "This is a bug in the module.\n", ast_module_name(mod)); + /* Dependencies were met but the module failed to start and the result + * code was not AST_MODULE_LOAD_FAILURE or AST_MODULE_LOAD_DECLINE. */ res = -1; break; } @@ -1637,17 +1643,17 @@ static int start_resource_list(struct module_vector *resources, int *mod_count) } if (AST_VECTOR_SIZE(&missingdeps)) { - ast_log(LOG_ERROR, "Failed to load %s due to unfilled dependencies.\n", + ast_log(LOG_WARNING, "Failed to load %s due to unfilled dependencies.\n", ast_module_name(mod)); - res = -1; - break; - } + mod->flags.declined = 1; + AST_VECTOR_RESET(&missingdeps, AST_VECTOR_ELEM_CLEANUP_NOOP); - res = start_resource_attempt(mod, mod_count); - if (res) { - ast_log(LOG_ERROR, "Failed to load %s: %d\n", ast_module_name(mod), res); - break; + continue; } + + /* If we're here it means that we started with missingdeps and they're all loaded + * now. It's impossible to reach this point a second time for the same module. */ + goto retry_load; } AST_VECTOR_FREE(&missingdeps); |