[asterisk-commits] tilghman: branch 1.8 r284610 - in /branches/1.8: apps/ channels/ funcs/ inclu...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 2 00:21:10 CDT 2010


Author: tilghman
Date: Thu Sep  2 00:20:59 2010
New Revision: 284610

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=284610
Log:
When optional_api is non-optional, force dependent modules to be loaded.

(closes issue #17707)
 Reported by: ira
 Patches: 
       20100819__issue17707__asterisk1.8.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman
 
Review: https://reviewboard.asterisk.org/r/876/

Modified:
    branches/1.8/apps/app_adsiprog.c
    branches/1.8/apps/app_followme.c
    branches/1.8/apps/app_getcpeid.c
    branches/1.8/apps/app_queue.c
    branches/1.8/apps/app_speech_utils.c
    branches/1.8/apps/app_stack.c
    branches/1.8/apps/app_voicemail.c
    branches/1.8/channels/chan_agent.c
    branches/1.8/channels/chan_dahdi.c
    branches/1.8/channels/chan_iax2.c
    branches/1.8/channels/chan_mgcp.c
    branches/1.8/channels/chan_sip.c
    branches/1.8/funcs/func_aes.c
    branches/1.8/include/asterisk/module.h
    branches/1.8/main/loader.c
    branches/1.8/pbx/pbx_dundi.c
    branches/1.8/pbx/pbx_loopback.c
    branches/1.8/pbx/pbx_realtime.c

Modified: branches/1.8/apps/app_adsiprog.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_adsiprog.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_adsiprog.c (original)
+++ branches/1.8/apps/app_adsiprog.c Thu Sep  2 00:20:59 2010
@@ -1591,4 +1591,8 @@
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Asterisk ADSI Programming Application");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk ADSI Programming Application",
+		.load = load_module,
+		.unload = unload_module,
+		.nonoptreq = "res_adsi",
+		);

Modified: branches/1.8/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_followme.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_followme.c (original)
+++ branches/1.8/apps/app_followme.c Thu Sep  2 00:20:59 2010
@@ -51,7 +51,6 @@
 #include "asterisk/cli.h"
 #include "asterisk/manager.h"
 #include "asterisk/config.h"
-#include "asterisk/monitor.h"
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/astdb.h"

Modified: branches/1.8/apps/app_getcpeid.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_getcpeid.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_getcpeid.c (original)
+++ branches/1.8/apps/app_getcpeid.c Thu Sep  2 00:20:59 2010
@@ -132,4 +132,8 @@
 	return ast_register_application_xml(app, cpeid_exec);
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Get ADSI CPE ID");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Get ADSI CPE ID",
+		.load = load_module,
+		.unload = unload_module,
+		.nonoptreq = "res_adsi",
+		);

Modified: branches/1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_queue.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_queue.c (original)
+++ branches/1.8/apps/app_queue.c Thu Sep  2 00:20:59 2010
@@ -57,7 +57,7 @@
  */
 
 /*** MODULEINFO
-	<depend>res_monitor</depend>
+	<use>res_monitor</use>
  ***/
 
 #include "asterisk.h"
@@ -8197,5 +8197,6 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_DEVSTATE_CONSUMER,
+		.nonoptreq = "res_monitor",
 	       );
 

Modified: branches/1.8/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_speech_utils.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_speech_utils.c (original)
+++ branches/1.8/apps/app_speech_utils.c Thu Sep  2 00:20:59 2010
@@ -955,4 +955,8 @@
 	return res;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan Speech Applications");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Dialplan Speech Applications",
+		.load = load_module,
+		.unload = unload_module,
+		.nonoptreq = "res_speech",
+		);

Modified: branches/1.8/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_stack.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_stack.c (original)
+++ branches/1.8/apps/app_stack.c Thu Sep  2 00:20:59 2010
@@ -704,4 +704,8 @@
 	return 0;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan subroutines (Gosub, Return, etc)");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Dialplan subroutines (Gosub, Return, etc)",
+		.load = load_module,
+		.unload = unload_module,
+		.nonoptreq = "res_agi",
+		);

Modified: branches/1.8/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_voicemail.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/apps/app_voicemail.c (original)
+++ branches/1.8/apps/app_voicemail.c Thu Sep  2 00:20:59 2010
@@ -38,7 +38,8 @@
  */
 
 /*** MODULEINFO
-	<depend>res_smdi</depend>
+	<use>res_adsi</use>
+	<use>res_smdi</use>
  ***/
 
 /*** MAKEOPTS
@@ -13085,4 +13086,5 @@
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
+		.nonoptreq = "res_adsi,res_smdi",
 		);

Modified: branches/1.8/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_agent.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/channels/chan_agent.c (original)
+++ branches/1.8/channels/chan_agent.c Thu Sep  2 00:20:59 2010
@@ -32,6 +32,7 @@
  */
 /*** MODULEINFO
         <depend>chan_local</depend>
+        <depend>res_monitor</depend>
  ***/
 
 #include "asterisk.h"
@@ -2484,4 +2485,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
+		.nonoptreq = "res_monitor,chan_local",
 	       );

Modified: branches/1.8/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_dahdi.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/channels/chan_dahdi.c (original)
+++ branches/1.8/channels/chan_dahdi.c Thu Sep  2 00:20:59 2010
@@ -38,7 +38,7 @@
  */
 
 /*** MODULEINFO
-	<depend>res_smdi</depend>
+	<use>res_smdi</use>
 	<depend>dahdi</depend>
 	<depend>tonezone</depend>
 	<use>pri</use>
@@ -17916,4 +17916,5 @@
 	.unload = unload_module,
 	.reload = reload,
 	.load_pri = AST_MODPRI_CHANNEL_DRIVER,
+		.nonoptreq = "res_smdi",
 	);

Modified: branches/1.8/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_iax2.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/channels/chan_iax2.c (original)
+++ branches/1.8/channels/chan_iax2.c Thu Sep  2 00:20:59 2010
@@ -14620,4 +14620,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
+		.nonoptreq = "res_crypto",
 		);

Modified: branches/1.8/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_mgcp.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/channels/chan_mgcp.c (original)
+++ branches/1.8/channels/chan_mgcp.c Thu Sep  2 00:20:59 2010
@@ -30,7 +30,7 @@
  */
 
 /*** MODULEINFO
-        <depend>res_pktccops</depend>
+        <use>res_pktccops</use>
  ***/
 
 #include "asterisk.h"
@@ -4915,4 +4915,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
+		.nonoptreq = "res_pktccops",
 	       );

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Sep  2 00:20:59 2010
@@ -162,6 +162,7 @@
  */
 
 /*** MODULEINFO
+	<depend>res_crypto</depend>
 	<depend>chan_local</depend>
  ***/
 
@@ -28589,4 +28590,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
+		.nonoptreq = "res_crypto,chan_local",
 	       );

Modified: branches/1.8/funcs/func_aes.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/funcs/func_aes.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/funcs/func_aes.c (original)
+++ branches/1.8/funcs/func_aes.c Thu Sep  2 00:20:59 2010
@@ -163,4 +163,8 @@
 	return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "AES dialplan functions");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "AES dialplan functions",
+		.load = load_module,
+		.unload = unload_module,
+		.nonoptreq = "res_crypto",
+	);

Modified: branches/1.8/include/asterisk/module.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/module.h?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/include/asterisk/module.h (original)
+++ branches/1.8/include/asterisk/module.h Thu Sep  2 00:20:59 2010
@@ -242,6 +242,11 @@
 	 *  this value will never be read and the module will be given the lowest possible priority
 	 *  on load. */
 	unsigned char load_pri;
+
+	/*! Modules which should be loaded first, in comma-separated string format.
+	 * These are only required for loading, when the optional_api header file
+	 * detects that the compiler does not support the optional API featureset. */
+	const char *nonoptreq;
 };
 
 void ast_module_register(const struct ast_module_info *);

Modified: branches/1.8/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/loader.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/main/loader.c (original)
+++ branches/1.8/main/loader.c Thu Sep  2 00:20:59 2010
@@ -414,6 +414,26 @@
 		return NULL;
 	}
 
+	/* This section is a workaround for a gcc 4.1 bug that has already been
+	 * fixed in later versions.  Unfortunately, some distributions, such as
+	 * RHEL/CentOS 5, distribute gcc 4.1, so we're stuck with having to deal
+	 * with this issue.  This basically ensures that optional_api modules are
+	 * loaded before any module which requires their functionality. */
+#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref)
+	if (!ast_strlen_zero(mod->info->nonoptreq)) {
+		/* Force any required dependencies to load */
+		char *each, *required_resource = ast_strdupa(mod->info->nonoptreq);
+		while ((each = strsep(&required_resource, ","))) {
+			each = ast_strip(each);
+
+			/* Is it already loaded? */
+			if (!find_resource(each, 0)) {
+				load_dynamic_module(each, global_symbols_only);
+			}
+		}
+	}
+#endif
+
 	while (!dlclose(lib));
 	resource_being_loaded = NULL;
 

Modified: branches/1.8/pbx/pbx_dundi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_dundi.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/pbx/pbx_dundi.c (original)
+++ branches/1.8/pbx/pbx_dundi.c Thu Sep  2 00:20:59 2010
@@ -4880,5 +4880,6 @@
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
+		.nonoptreq = "res_crypto",
 	       );
 

Modified: branches/1.8/pbx/pbx_loopback.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_loopback.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/pbx/pbx_loopback.c (original)
+++ branches/1.8/pbx/pbx_loopback.c Thu Sep  2 00:20:59 2010
@@ -41,7 +41,6 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/utils.h"
-#include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 
 

Modified: branches/1.8/pbx/pbx_realtime.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/pbx/pbx_realtime.c?view=diff&rev=284610&r1=284609&r2=284610
==============================================================================
--- branches/1.8/pbx/pbx_realtime.c (original)
+++ branches/1.8/pbx/pbx_realtime.c Thu Sep  2 00:20:59 2010
@@ -46,7 +46,6 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/utils.h"
-#include "asterisk/crypto.h"
 #include "asterisk/astdb.h"
 #include "asterisk/app.h"
 #include "asterisk/astobj2.h"




More information about the asterisk-commits mailing list