public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-misc/asterisk/files/1.6.1: asterisk-1.6.1.14-graceful-restart-segfault.patch asterisk-1.6.1.14-parallel-make.patch
@ 2010-02-10 22:44 Tony Vroon (chainsaw)
  0 siblings, 0 replies; only message in thread
From: Tony Vroon (chainsaw) @ 2010-02-10 22:44 UTC (permalink / raw
  To: gentoo-commits

chainsaw    10/02/10 22:44:33

  Added:                asterisk-1.6.1.14-graceful-restart-segfault.patch
                        asterisk-1.6.1.14-parallel-make.patch
  Log:
  Add nv_faxdetect as scavenged by Cory Coager in bug #298328. Trim unnecessary parts from parallel make patch, upstream bug #16489. Stop segfaulting on a graceful restart, upstream bugs #16062 & #16470.
  (Portage version: 2.2_rc62/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-graceful-restart-segfault.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-graceful-restart-segfault.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-graceful-restart-segfault.patch?rev=1.1&content-type=text/plain

Index: asterisk-1.6.1.14-graceful-restart-segfault.patch
===================================================================
diff -uNr asterisk-1.6.1.14.ORIG/main/event.c asterisk-1.6.1.14/main/event.c
--- asterisk-1.6.1.14.ORIG/main/event.c	2010-02-10 22:37:28.868432167 +0000
+++ asterisk-1.6.1.14/main/event.c	2010-02-10 22:38:31.532132064 +0000
@@ -841,6 +841,11 @@
 	struct ast_event_iterator iterator;
 	int res = 0;
 
+	/* Event has no IEs allocated */
+	if (event->event_len < sizeof(*event) + sizeof(ie_type)) {
+		return NULL;
+	}
+
 	for (ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
 		if (ast_event_iterator_get_ie_type(&iterator) == ie_type)
 			return ast_event_iterator_get_ie_raw(&iterator);
diff -uNr asterisk-1.6.1.14.ORIG/main/loader.c asterisk-1.6.1.14/main/loader.c
--- asterisk-1.6.1.14.ORIG/main/loader.c	2010-02-10 22:37:28.863390515 +0000
+++ asterisk-1.6.1.14/main/loader.c	2010-02-10 22:38:31.531140265 +0000
@@ -443,26 +443,39 @@
 void ast_module_shutdown(void)
 {
 	struct ast_module *mod;
-	AST_LIST_HEAD_NOLOCK_STATIC(local_module_list, ast_module);
-
-	/* We have to call the unload() callbacks in reverse order that the modules
-	 * exist in the module list so it is the reverse order of how they were
-	 * loaded. */
+	int somethingchanged = 1, final = 0;
 
 	AST_LIST_LOCK(&module_list);
-	while ((mod = AST_LIST_REMOVE_HEAD(&module_list, entry)))
-		AST_LIST_INSERT_HEAD(&local_module_list, mod, entry);
-	AST_LIST_UNLOCK(&module_list);
 
-	while ((mod = AST_LIST_REMOVE_HEAD(&local_module_list, entry))) {
-		if (mod->info->unload)
-			mod->info->unload();
-		/* Since this should only be called when shutting down "gracefully",
-		 * all channels should be down before we get to this point, meaning
-		 * there will be no module users left. */
-		AST_LIST_HEAD_DESTROY(&mod->users);
-		free(mod);
-	}
+	/*!\note Some resources, like timers, are started up dynamically, and thus
+	 * may be still in use, even if all channels are dead.  We must therefore
+	 * check the usecount before asking modules to unload. */
+	do {
+		if (!somethingchanged) {
+			/*!\note If we go through the entire list without changing
+			 * anything, ignore the usecounts and unload, then exit. */
+			final = 1;
+		}
+
+		/* Reset flag before traversing the list */
+		somethingchanged = 0;
+
+		AST_LIST_TRAVERSE_SAFE_BEGIN(&module_list, mod, entry) {
+			if (!final && mod->usecount) {
+				continue;
+			}
+			AST_LIST_REMOVE_CURRENT(entry);
+			if (mod->info->unload) {
+				mod->info->unload();
+			}
+			AST_LIST_HEAD_DESTROY(&mod->users);
+			free(mod);
+			somethingchanged = 1;
+		}
+		AST_LIST_TRAVERSE_SAFE_END;
+	} while (somethingchanged && !final);
+
+	AST_LIST_UNLOCK(&module_list);
 }
 
 int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode force)



1.1                  net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-parallel-make.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-parallel-make.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.14-parallel-make.patch?rev=1.1&content-type=text/plain

Index: asterisk-1.6.1.14-parallel-make.patch
===================================================================
diff -uNr asterisk-1.6.1.14.ORIG/Makefile asterisk-1.6.1.14/Makefile
--- asterisk-1.6.1.14.ORIG/Makefile	2010-02-10 22:33:29.357131986 +0000
+++ asterisk-1.6.1.14/Makefile	2010-02-10 22:34:26.505462558 +0000
@@ -556,7 +556,7 @@
 	fi
 
 $(SUBDIRS_INSTALL):
-	@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
+	+@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" $(SUBMAKE) -C $(@:-install=) install
 
 NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
 OLDMODS=$(filter-out $(NEWMODS),$(notdir $(wildcard $(DESTDIR)$(MODULES_DIR)/*.so)))
@@ -805,7 +805,7 @@
 	@cmp -s .cleancount .lastclean || $(MAKE) clean
 
 $(SUBDIRS_UNINSTALL):
-	@$(SUBMAKE) -C $(@:-uninstall=) uninstall
+	+@$(SUBMAKE) -C $(@:-uninstall=) uninstall
 
 _uninstall: $(SUBDIRS_UNINSTALL)
 	rm -f $(DESTDIR)$(MODULES_DIR)/*






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-10 22:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 22:44 [gentoo-commits] gentoo-x86 commit in net-misc/asterisk/files/1.6.1: asterisk-1.6.1.14-graceful-restart-segfault.patch asterisk-1.6.1.14-parallel-make.patch Tony Vroon (chainsaw)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox