[asterisk-commits] pcadach: branch pcadach/chan_h323-live r40954 - in /team/pcadach/chan_h323-li...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Aug 23 13:37:25 MST 2006


Author: pcadach
Date: Wed Aug 23 15:37:25 2006
New Revision: 40954

URL: http://svn.digium.com/view/asterisk?rev=40954&view=rev
Log:
Merged revisions 40837,40853-40854,40863-40864,40866,40877,40904,40928,40946,40949,40953 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r40837 | kpfleming | 2006-08-22 22:32:41 +0600 (Втр, 22 Авг 2006) | 2 lines

remove requirement for libtasn1, which appears to be a Debian thing

................
r40853 | kpfleming | 2006-08-23 03:45:15 +0600 (Срд, 23 Авг 2006) | 2 lines

add a new include file for out-of-tree modules that need to know where things are located

................
r40854 | kpfleming | 2006-08-23 03:57:16 +0600 (Срд, 23 Авг 2006) | 2 lines

when loadable modules are disabled, if someone tries to load a module that does not exist, don't dereference a NULL pointer, just stop trying to load it...

................
r40863 | kpfleming | 2006-08-23 05:06:13 +0600 (Срд, 23 Авг 2006) | 2 lines

minor improvements

................
r40864 | kpfleming | 2006-08-23 05:07:11 +0600 (Срд, 23 Авг 2006) | 2 lines

make platforms that use mutexes in stdio.h happy

................
r40866 | kpfleming | 2006-08-23 05:55:16 +0600 (Срд, 23 Авг 2006) | 2 lines

generate a message when a module cannot be found and loadable modules are disabled

................
r40877 | russell | 2006-08-23 09:07:34 +0600 (Срд, 23 Авг 2006) | 2 lines

merge menuselect_build ... most of the changes happened in menuselect

................
r40904 | tilghman | 2006-08-23 22:14:18 +0600 (Срд, 23 Авг 2006) | 10 lines

Merged revisions 40901 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r40901 | tilghman | 2006-08-23 11:05:26 -0500 (Wed, 23 Aug 2006) | 2 lines

Revert last change - breaks retrieval of builtin variables

........

................
r40928 | russell | 2006-08-23 23:44:33 +0600 (Срд, 23 Авг 2006) | 2 lines

remove svnmerge-integrated property

................
r40946 | qwell | 2006-08-24 00:51:39 +0600 (Чтв, 24 Авг 2006) | 2 lines

move the "muted" svn:ignore to the utils/ directory

................
r40949 | kpfleming | 2006-08-24 01:28:13 +0600 (Чтв, 24 Авг 2006) | 3 lines

use RTLD_NOLOAD if it's available to make loading dynamic modules a little faster and less resource-intensive
also, keep trying to dlclose() a module until it actually goes away, since it may have other modules it brought in when it was loaded (thanks PCadach for pointing this problem out to me)

................
r40953 | file | 2006-08-24 02:22:18 +0600 (Чтв, 24 Авг 2006) | 2 lines

Free the filename so we don't have a memory leak. (reported by PCadach in #asterisk-bugs)

................

Added:
    team/pcadach/chan_h323-live/include/asterisk/paths.h   (props changed)
      - copied unchanged from r40953, trunk/include/asterisk/paths.h
Modified:
    team/pcadach/chan_h323-live/   (props changed)
    team/pcadach/chan_h323-live/Makefile
    team/pcadach/chan_h323-live/configure
    team/pcadach/chan_h323-live/configure.ac
    team/pcadach/chan_h323-live/include/asterisk.h
    team/pcadach/chan_h323-live/include/asterisk/autoconfig.h.in
    team/pcadach/chan_h323-live/main/chanvars.c
    team/pcadach/chan_h323-live/main/file.c
    team/pcadach/chan_h323-live/main/loader.c
    team/pcadach/chan_h323-live/res/res_agi.c

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
--- svn:externals (original)
+++ svn:externals Wed Aug 23 15:37:25 2006
@@ -1,2 +1,1 @@
-menuselect	http://svn.digium.com/svn/menuselect/trunk
-mxml		http://svn.digium.com/svn/mxml/trunk
+menuselect	http://svn.digium.com/svn/menuselect/branches/1.0

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Aug 23 15:37:25 2006
@@ -21,5 +21,4 @@
 config.log
 menuselect-tree
 autom4te.cache
-muted
 makeopts.embed_rules

Propchange: team/pcadach/chan_h323-live/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Aug 23 15:37:25 2006
@@ -1,1 +1,1 @@
-/trunk:1-40833
+/trunk:1-40953

Modified: team/pcadach/chan_h323-live/Makefile
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/Makefile?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/Makefile (original)
+++ team/pcadach/chan_h323-live/Makefile Wed Aug 23 15:37:25 2006
@@ -319,10 +319,9 @@
 dist-clean: distclean
 
 distclean: clean
-	@$(MAKE) -C mxml clean
 	@$(MAKE) -C menuselect dist-clean
 	@$(MAKE) -C sounds dist-clean
-	rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
+	rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
 	rm -f makeopts.embed_rules
 	rm -f config.log config.status
 	rm -rf autom4te.cache
@@ -646,12 +645,8 @@
 menuselect: menuselect/menuselect menuselect-tree
 	- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
 
-menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts mxml/libmxml.a
-	@CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect CC="$(HOST_CC)" menuselect
-
-mxml/libmxml.a:
-	@cd mxml && unset CC CFLAGS LDFLAGS && test -f config.h || ./configure --build=$(BUILD_PLATFORM) --host=$(BUILD_PLATFORM)
-	$(MAKE) -C mxml libmxml.a
+menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts
+	@CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect CC="$(HOST_CC)"
 
 menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
 	@echo "Generating input for menuselect ..."

Modified: team/pcadach/chan_h323-live/configure
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/configure?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/configure (original)
+++ team/pcadach/chan_h323-live/configure Wed Aug 23 15:37:25 2006
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 40756 .
+# From configure.ac Revision: 40834 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -11599,6 +11599,62 @@
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 
+echo "$as_me:$LINENO: checking checking for RTLD_NOLOAD" >&5
+echo $ECHO_N "checking checking for RTLD_NOLOAD... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <dlfcn.h>
+int
+main ()
+{
+int foo = RTLD_NOLOAD;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_RTLD_NOLOAD 1
+_ACEOF
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
 
 echo "$as_me:$LINENO: checking checking for compiler 'attribute pure' support" >&5
 echo $ECHO_N "checking checking for compiler 'attribute pure' support... $ECHO_C" >&6
@@ -14207,7 +14263,7 @@
 fi
 
    if test "${PBX_GNUTLS}" = 1; then
-      IKSEMEL_LIB="${IKSEMEL_LIB} -lgnutls -ltasn1 -lz -lgcrypt -lnsl -lgpg-error"
+      IKSEMEL_LIB="${IKSEMEL_LIB} -lgnutls -lz -lgcrypt -lnsl -lgpg-error"
    fi
 fi
 

Modified: team/pcadach/chan_h323-live/configure.ac
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/configure.ac?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/configure.ac (original)
+++ team/pcadach/chan_h323-live/configure.ac Wed Aug 23 15:37:25 2006
@@ -238,6 +238,15 @@
 	AC_MSG_RESULT(no)
 )
 
+AC_MSG_CHECKING(checking for RTLD_NOLOAD)
+AC_LINK_IFELSE(
+	AC_LANG_PROGRAM([#include <dlfcn.h>],
+			[int foo = RTLD_NOLOAD;]),
+	AC_MSG_RESULT(yes)
+	AC_DEFINE([HAVE_RTLD_NOLOAD], 1, [Define to 1 if your system has a dynamic linker that supports RTLD_NOLOAD.]),
+	AC_MSG_RESULT(no)
+)
+
 AST_GCC_ATTRIBUTE(pure)
 AST_GCC_ATTRIBUTE(malloc)
 AST_GCC_ATTRIBUTE(const)
@@ -295,7 +304,7 @@
 if test "${PBX_IKSEMEL}" = 1; then
    AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye])
    if test "${PBX_GNUTLS}" = 1; then
-      IKSEMEL_LIB="${IKSEMEL_LIB} -lgnutls -ltasn1 -lz -lgcrypt -lnsl -lgpg-error"
+      IKSEMEL_LIB="${IKSEMEL_LIB} -lgnutls -lz -lgcrypt -lnsl -lgpg-error"
    fi
 fi
 

Modified: team/pcadach/chan_h323-live/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/include/asterisk.h?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/include/asterisk.h (original)
+++ team/pcadach/chan_h323-live/include/asterisk.h Wed Aug 23 15:37:25 2006
@@ -22,7 +22,7 @@
 
 #include "asterisk/compat.h"
 
-#include <limits.h>
+#include "asterisk/paths.h"
 
 #define DEFAULT_LANGUAGE "en"
 

Modified: team/pcadach/chan_h323-live/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/include/asterisk/autoconfig.h.in?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/include/asterisk/autoconfig.h.in (original)
+++ team/pcadach/chan_h323-live/include/asterisk/autoconfig.h.in Wed Aug 23 15:37:25 2006
@@ -269,6 +269,10 @@
 
 /* Define to 1 if you have the `rint' function. */
 #undef HAVE_RINT
+
+/* Define to 1 if your system has a dynamic linker that supports RTLD_NOLOAD.
+   */
+#undef HAVE_RTLD_NOLOAD
 
 /* Define to 1 if you have the `select' function. */
 #undef HAVE_SELECT

Propchange: team/pcadach/chan_h323-live/include/asterisk/paths.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/pcadach/chan_h323-live/include/asterisk/paths.h
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: team/pcadach/chan_h323-live/include/asterisk/paths.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/pcadach/chan_h323-live/main/chanvars.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/main/chanvars.c?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/main/chanvars.c (original)
+++ team/pcadach/chan_h323-live/main/chanvars.c Wed Aug 23 15:37:25 2006
@@ -27,6 +27,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 

Modified: team/pcadach/chan_h323-live/main/file.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/main/file.c?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/main/file.c (original)
+++ team/pcadach/chan_h323-live/main/file.c Wed Aug 23 15:37:25 2006
@@ -417,6 +417,7 @@
 					chan->stream = s;
 				else
 					chan->vstream = s;
+				free(fn);
 				break;
 			}
 			switch (action) {

Modified: team/pcadach/chan_h323-live/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/main/loader.c?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/main/loader.c (original)
+++ team/pcadach/chan_h323-live/main/loader.c Wed Aug 23 15:37:25 2006
@@ -324,7 +324,7 @@
 static void unload_dynamic_module(struct ast_module *mod)
 {
 	if (mod->lib)
-		dlclose(mod->lib);
+		while (!dlclose(mod->lib));
 	/* WARNING: the structure pointed to by mod is now gone! */
 }
 
@@ -368,7 +368,7 @@
 	*/
 	if (resource_being_loaded != (mod = AST_LIST_LAST(&module_list))) {
 		/* no, it did not, so close it and return */
-		dlclose(lib);
+		while (!dlclose(lib));
 		/* note that the module's destructor will call ast_module_unregister(),
 		   which will free the structure we allocated in resource_being_loaded */
 		return NULL;
@@ -376,15 +376,27 @@
 
 	wants_global = ast_test_flag(mod->info, AST_MODFLAG_GLOBAL_SYMBOLS);
 
-	/* we are done with this first load, so clean up and start over */
-
-	dlclose(lib);
-	resource_being_loaded = NULL;
-
 	/* if we are being asked only to load modules that provide global symbols,
 	   and this one does not, then close it and return */
-	if (global_symbols_only && !wants_global)
+	if (global_symbols_only && !wants_global) {
+		while (!dlclose(lib));
 		return NULL;
+	}
+
+	/* if the system supports RTLD_NOLOAD, we can just 'promote' the flags
+	   on the already-opened library to what we want... if not, we have to
+	   close it and start over
+	*/
+#if HAVE_RTLD_NOLOAD
+	if (!dlopen(fn, RTLD_NOLOAD | (wants_global ? RTLD_GLOBAL : RTLD_NOW))) {
+		ast_log(LOG_WARNING, "%s\n", dlerror());
+		while (!dlclose(lib));
+		free(resource_being_loaded);
+		return NULL;
+	}
+#else
+	while (!dlclose(lib));
+	resource_being_loaded = NULL;
 
 	/* start the load process again */
 
@@ -402,6 +414,8 @@
 	/* since the module was successfully opened, and it registered itself
 	   the previous time we did that, we're going to assume it worked this
 	   time too :) */
+#endif
+
 	AST_LIST_LAST(&module_list)->lib = lib;
 	resource_being_loaded = NULL;
 
@@ -417,7 +431,10 @@
 
 	AST_LIST_LOCK(&module_list);
 
-	mod = find_resource(resource_name, 0);
+	if (!(mod = find_resource(resource_name, 0))) {
+		AST_LIST_UNLOCK(&module_list);
+		return 0;
+	}
 
 	if (!ast_test_flag(mod, FLAG_RUNNING | FLAG_DECLINED))
 		error = 1;
@@ -576,8 +593,8 @@
 		}
 		if (global_symbols_only && !ast_test_flag(mod->info, AST_MODFLAG_GLOBAL_SYMBOLS))
 			return AST_MODULE_LOAD_SKIP;
+	} else {
 #if LOADABLE_MODULES
-	} else {
 		if (!(mod = load_dynamic_module(resource_name, global_symbols_only))) {
 			/* don't generate a warning message during load_modules() */
 			if (!global_symbols_only) {
@@ -587,6 +604,9 @@
 				return AST_MODULE_LOAD_SKIP;
 			}
 		}
+#else
+		ast_log(LOG_WARNING, "Module '%s' could not be loaded.\n", resource_name);
+		return AST_MODULE_LOAD_DECLINE;
 #endif
 	}
 
@@ -643,7 +663,6 @@
 
 struct load_order_entry {
 	char *resource;
-	unsigned int embedded;
 	AST_LIST_ENTRY(load_order_entry) entry;
 };
 
@@ -699,33 +718,21 @@
 
 	AST_LIST_HEAD_INIT_NOLOCK(&load_order);
 
-	if (preload_only) {
-		/* first, find all the modules we have been explicitly requested to load */
-		for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
-			if (!strcasecmp(v->name, "preload"))
-				add_to_load_order(v->value, &load_order);
-		}
-	} else {
-		/* first, find all the modules we have been explicitly requested to load */
-		for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
-			if (!strcasecmp(v->name, "load"))
-				add_to_load_order(v->value, &load_order);
-		}
+	/* first, find all the modules we have been explicitly requested to load */
+	for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
+		if (!strcasecmp(v->name, preload_only ? "preload" : "load"))
+			add_to_load_order(v->value, &load_order);
 	}
 
 	/* check if 'autoload' is on */
 	if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
 		/* if so, first add all the embedded modules to the load order */
-		AST_LIST_TRAVERSE(&module_list, mod, entry) {
+		AST_LIST_TRAVERSE(&module_list, mod, entry)
 			order = add_to_load_order(mod->resource, &load_order);
 
-			if (order)
-				order->embedded = 1;
-		}
-
+#if LOADABLE_MODULES
 		/* if we are allowed to load dynamic modules, scan the directory for
 		   for all available modules and add them as well */
-#if LOADABLE_MODULES
 		if ((dir  = opendir(ast_config_AST_MODULE_DIR))) {
 			while ((dirent = readdir(dir))) {
 				int ld = strlen(dirent->d_name);
@@ -775,7 +782,8 @@
 	AST_LIST_TRAVERSE(&load_order, order, entry)
 		load_count++;
 
-	ast_log(LOG_NOTICE, "%d modules will be loaded.\n", load_count);
+	if (load_count)
+		ast_log(LOG_NOTICE, "%d modules will be loaded.\n", load_count);
 
 	/* first, load only modules that provide global symbols */
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) {

Modified: team/pcadach/chan_h323-live/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/res/res_agi.c?rev=40954&r1=40953&r2=40954&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/res/res_agi.c (original)
+++ team/pcadach/chan_h323-live/res/res_agi.c Wed Aug 23 15:37:25 2006
@@ -1164,17 +1164,18 @@
 
 static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv)
 {
-	const char *ret;
+	char *ret;
 	char tempstr[1024];
 
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
 
 	/* check if we want to execute an ast_custom_function */
-	if (!ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] == ')'))
+	if (!ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] == ')')) {
 		ret = ast_func_read(chan, argv[2], tempstr, sizeof(tempstr)) ? NULL : tempstr;
-	else
-		ret = pbx_builtin_getvar_helper(chan, argv[2]);
+	} else {
+		pbx_retrieve_variable(chan, argv[2], &ret, tempstr, sizeof(tempstr), NULL);
+	}
 
 	if (ret)
 		fdprintf(agi->fd, "200 result=1 (%s)\n", ret);



More information about the asterisk-commits mailing list