/pidgin/main: 161320946afd: Remove SIGCHLD signal handler.

Elliott Sales de Andrade qulogic at pidgin.im
Sat Sep 8 19:20:48 EDT 2012


Changeset: 161320946afdd6bc331026fa774e1f7bc680f12c
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-09-05 04:26 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/161320946afd

Description:

Remove SIGCHLD signal handler.

DNS processes are already reaped in libpurple. Sound processes are
reaped after 15 seconds. Other processes are sent through GLib and
reaped by it. Anyway, this means we can stop preventing GStreamer
from forking, and maybe fix a D-Bus bug, or something.

Fixes #5553.
Fixes #7902.

diffstat:

 configure.ac      |   7 ------
 pidgin/gtkmain.c  |  56 +-----------------------------------------------------
 pidgin/gtksound.c |   3 --
 3 files changed, 2 insertions(+), 64 deletions(-)

diffs (117 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -838,9 +838,6 @@ AM_GCONF_SOURCE_2
 dnl #######################################################################
 dnl # Check for GStreamer
 dnl #######################################################################
-dnl
-dnl TODO: Depend on gstreamer >= 0.10.10, and remove the conditional use of
-dnl       gst_registry_fork_set_enabled.
 AC_ARG_ENABLE(gstreamer,
 	[AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
 	enable_gst="$enableval", enable_gst="yes")
@@ -849,10 +846,6 @@ if test "x$enable_gst" != "xno"; then
 		AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
 		AC_SUBST(GSTREAMER_CFLAGS)
 		AC_SUBST(GSTREAMER_LIBS)
-		AC_CHECK_LIB(gstreamer-0.10, gst_registry_fork_set_enabled,
-			[ AC_DEFINE(GST_CAN_DISABLE_FORKING, [],
-			  [Define if gst_registry_fork_set_enabled exists])],
-			[], [$GSTREAMER_LIBS])
 	], [
 		AC_MSG_RESULT(no)
 		enable_gst="no"
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -88,10 +88,6 @@ static const int catch_sig_list[] = {
 	SIGINT,
 	SIGTERM,
 	SIGQUIT,
-	SIGCHLD,
-#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
-	SIGALRM,
-#endif
 	-1
 };
 
@@ -136,29 +132,6 @@ static int signal_sockets[2];
 
 static void sighandler(int sig);
 
-/*
- * This child process reaping stuff is currently only used for processes that
- * were forked to play sounds.  It's not needed for forked DNS child, which
- * have their own waitpid() call.  It might be wise to move this code into
- * gtksound.c.
- */
-static void
-clean_pid(void)
-{
-	int status;
-	pid_t pid;
-
-	do {
-		pid = waitpid(-1, &status, WNOHANG);
-	} while (pid != 0 && pid != (pid_t)-1);
-
-	if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
-		char errmsg[BUFSIZ];
-		snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid);
-		perror(errmsg);
-	}
-}
-
 static void sighandler(int sig)
 {
 	ssize_t written;
@@ -209,33 +182,8 @@ mainloop_sighandler(GIOChannel *source, 
 		return FALSE;
 	}
 
-	switch (sig) {
-#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
-/* By default, gstreamer forks when you initialize it, and waitpids for the
- * child.  But if libpurple reaps the child rather than leaving it to
- * gstreamer, gstreamer's initialization fails.  So, we wait a second before
- * reaping child processes, to give gst a chance to reap it if it wants to.
- *
- * This is not needed in later gstreamers, which let us disable the forking.
- * And, it breaks the world on some Real Unices.
- */
-	case SIGCHLD:
-		/* Restore signal catching */
-		signal(SIGCHLD, sighandler);
-		alarm(1);
-		break;
-	case SIGALRM:
-#else
-	case SIGCHLD:
-#endif
-		clean_pid();
-		/* Restore signal catching */
-		signal(SIGCHLD, sighandler);
-		break;
-	default:
-		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
-		purple_core_quit();
-	}
+	purple_debug_warning("sighandler", "Caught signal %d\n", sig);
+	purple_core_quit();
 
 	return TRUE;
 }
diff --git a/pidgin/gtksound.c b/pidgin/gtksound.c
--- a/pidgin/gtksound.c
+++ b/pidgin/gtksound.c
@@ -319,9 +319,6 @@ pidgin_sound_init(void)
 
 #ifdef USE_GSTREAMER
 	purple_debug_info("sound", "Initializing sound output drivers.\n");
-#ifdef GST_CAN_DISABLE_FORKING
-	gst_registry_fork_set_enabled (FALSE);
-#endif
 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
 		purple_notify_error(NULL, _("GStreamer Failure"),
 					_("GStreamer failed to initialize."),



More information about the Commits mailing list