aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2013-06-05 10:04:13 -0700
committerPaul Eggert2013-06-05 10:04:13 -0700
commitf019a684847950c24f5dd8ee8cfdd40d3511ba83 (patch)
tree1226d99c68968dd9b51cc0c15eba0e3c4ce670d0 /src/process.c
parent28f5da6df34eb64677e25afd001c1f48b012aec7 (diff)
downloademacs-f019a684847950c24f5dd8ee8cfdd40d3511ba83.tar.gz
emacs-f019a684847950c24f5dd8ee8cfdd40d3511ba83.zip
Chain glib's SIGCHLD handler from Emacs's (Bug#14474).
* process.c (dummy_handler): New function. (lib_child_handler): New static var. (handle_child_signal): Invoke it. (catch_child_signal): If a library has set up a signal handler, save it into lib_child_handler. (init_process_emacs): If using glib and not on Windows, tickle glib's child-handling code so that it initializes its private SIGCHLD handler. * syssignal.h (SA_SIGINFO): Default to 0. * xterm.c (x_term_init): Remove D-bus hack that I installed on May 31; it should no longer be needed now.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c
index 33035078df9..6ae02494d36 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6100,6 +6100,12 @@ process has been transmitted to the serial port. */)
6100 might inadvertently reap a GTK-created process that happened to 6100 might inadvertently reap a GTK-created process that happened to
6101 have the same process ID. */ 6101 have the same process ID. */
6102 6102
6103/* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing
6104 its own SIGCHLD handling. On POSIXish systems, glib needs this to
6105 keep track of its own children. The default handler does nothing. */
6106static void dummy_handler (int sig) {}
6107static signal_handler_t volatile lib_child_handler = dummy_handler;
6108
6103/* Handle a SIGCHLD signal by looking for known child processes of 6109/* Handle a SIGCHLD signal by looking for known child processes of
6104 Emacs whose status have changed. For each one found, record its 6110 Emacs whose status have changed. For each one found, record its
6105 new status. 6111 new status.
@@ -6184,6 +6190,8 @@ handle_child_signal (int sig)
6184 } 6190 }
6185 } 6191 }
6186 } 6192 }
6193
6194 lib_child_handler (sig);
6187} 6195}
6188 6196
6189static void 6197static void
@@ -7035,9 +7043,13 @@ static
7035void 7043void
7036catch_child_signal (void) 7044catch_child_signal (void)
7037{ 7045{
7038 struct sigaction action; 7046 struct sigaction action, old_action;
7039 emacs_sigaction_init (&action, deliver_child_signal); 7047 emacs_sigaction_init (&action, deliver_child_signal);
7040 sigaction (SIGCHLD, &action, 0); 7048 sigaction (SIGCHLD, &action, &old_action);
7049 eassert (! (old_action.sa_flags & SA_SIGINFO));
7050 if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN
7051 && old_action.sa_handler != deliver_child_signal)
7052 lib_child_handler = old_action.sa_handler;
7041} 7053}
7042 7054
7043 7055
@@ -7055,6 +7067,11 @@ init_process_emacs (void)
7055 if (! noninteractive || initialized) 7067 if (! noninteractive || initialized)
7056#endif 7068#endif
7057 { 7069 {
7070#if defined HAVE_GLIB && !defined WINDOWSNT
7071 /* Tickle glib's child-handling code so that it initializes its
7072 private SIGCHLD handler. */
7073 g_source_unref (g_child_watch_source_new (0));
7074#endif
7058 catch_child_signal (); 7075 catch_child_signal ();
7059 } 7076 }
7060 7077