aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/process.c21
-rw-r--r--src/syssignal.h4
-rw-r--r--src/xterm.c7
4 files changed, 37 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 67b1b482f3f..ac0563c6bdd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12013-06-05 Paul Eggert <eggert@cs.ucla.edu>
2
3 Chain glib's SIGCHLD handler from Emacs's (Bug#14474).
4 * process.c (dummy_handler): New function.
5 (lib_child_handler): New static var.
6 (handle_child_signal): Invoke it.
7 (catch_child_signal): If a library has set up a signal handler,
8 save it into lib_child_handler.
9 (init_process_emacs): If using glib and not on Windows, tickle glib's
10 child-handling code so that it initializes its private SIGCHLD handler.
11 * syssignal.h (SA_SIGINFO): Default to 0.
12 * xterm.c (x_term_init): Remove D-bus hack that I installed on May
13 31; it should no longer be needed now.
14
12013-06-05 Michael Albinus <michael.albinus@gmx.de> 152013-06-05 Michael Albinus <michael.albinus@gmx.de>
2 16
3 * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify. 17 * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify.
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
diff --git a/src/syssignal.h b/src/syssignal.h
index d7399c6cb8c..45ea8f1af3c 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -50,6 +50,10 @@ char const *safe_strsignal (int) ATTRIBUTE_CONST;
50# define NSIG NSIG_MINIMUM 50# define NSIG NSIG_MINIMUM
51#endif 51#endif
52 52
53#ifndef SA_SIGINFO
54# define SA_SIGINFO 0
55#endif
56
53#ifndef emacs_raise 57#ifndef emacs_raise
54# define emacs_raise(sig) raise (sig) 58# define emacs_raise(sig) raise (sig)
55#endif 59#endif
diff --git a/src/xterm.c b/src/xterm.c
index 7038de7039f..7505aa3936b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9897,13 +9897,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9897 9897
9898 XSetLocaleModifiers (""); 9898 XSetLocaleModifiers ("");
9899 9899
9900 /* If D-Bus is not already configured, inhibit D-Bus autolaunch,
9901 as autolaunch can mess up Emacs's SIGCHLD handler.
9902 FIXME: Rewrite subprocess handlers to use glib's child watchers.
9903 See Bug#14474. */
9904 if (! egetenv ("DBUS_SESSION_BUS_ADDRESS"))
9905 xputenv ("DBUS_SESSION_BUS_ADDRESS=unix:path=/dev/null");
9906
9907 /* Emacs can only handle core input events, so make sure 9900 /* Emacs can only handle core input events, so make sure
9908 Gtk doesn't use Xinput or Xinput2 extensions. */ 9901 Gtk doesn't use Xinput or Xinput2 extensions. */
9909 xputenv ("GDK_CORE_DEVICE_EVENTS=1"); 9902 xputenv ("GDK_CORE_DEVICE_EVENTS=1");