aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorTom Tromey2013-06-13 11:29:06 -0600
committerTom Tromey2013-06-13 11:29:06 -0600
commit5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da (patch)
treeaf9b79246f0b18d748c3e1c33b1bb1b33cf1fbe0 /src/process.c
parent313dfb6277b3e1ef28c7bb76e776f10168e3f0a3 (diff)
parent94fa6ec7b306b47c251f7b8b67662598027a7ff3 (diff)
downloademacs-5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da.tar.gz
emacs-5ccb7e7b1ea2ca7f6e45d00d839e19f22cc961da.zip
merge from trunk
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c
index c1726e7ad60..17facf567b8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4693,10 +4693,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4693 } 4693 }
4694#endif 4694#endif
4695 nfds = thread_select ( 4695 nfds = thread_select (
4696#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) 4696#if defined (HAVE_NS)
4697 xg_select
4698#elif defined (HAVE_NS)
4699 ns_select 4697 ns_select
4698#elif defined (HAVE_GLIB)
4699 xg_select
4700#else 4700#else
4701 pselect 4701 pselect
4702#endif 4702#endif
@@ -6255,6 +6255,12 @@ process has been transmitted to the serial port. */)
6255 might inadvertently reap a GTK-created process that happened to 6255 might inadvertently reap a GTK-created process that happened to
6256 have the same process ID. */ 6256 have the same process ID. */
6257 6257
6258/* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing
6259 its own SIGCHLD handling. On POSIXish systems, glib needs this to
6260 keep track of its own children. The default handler does nothing. */
6261static void dummy_handler (int sig) {}
6262static signal_handler_t volatile lib_child_handler = dummy_handler;
6263
6258/* Handle a SIGCHLD signal by looking for known child processes of 6264/* Handle a SIGCHLD signal by looking for known child processes of
6259 Emacs whose status have changed. For each one found, record its 6265 Emacs whose status have changed. For each one found, record its
6260 new status. 6266 new status.
@@ -6336,6 +6342,8 @@ handle_child_signal (int sig)
6336 } 6342 }
6337 } 6343 }
6338 } 6344 }
6345
6346 lib_child_handler (sig);
6339} 6347}
6340 6348
6341static void 6349static void
@@ -7181,14 +7189,19 @@ integer or floating point values.
7181 return system_process_attributes (pid); 7189 return system_process_attributes (pid);
7182} 7190}
7183 7191
7192#ifndef NS_IMPL_GNUSTEP
7193static
7194#endif
7184void 7195void
7185catch_child_signal (void) 7196catch_child_signal (void)
7186{ 7197{
7187#ifdef SIGCHLD 7198 struct sigaction action, old_action;
7188 struct sigaction action;
7189 emacs_sigaction_init (&action, deliver_child_signal); 7199 emacs_sigaction_init (&action, deliver_child_signal);
7190 sigaction (SIGCHLD, &action, 0); 7200 sigaction (SIGCHLD, &action, &old_action);
7191#endif 7201 eassert (! (old_action.sa_flags & SA_SIGINFO));
7202 if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN
7203 && old_action.sa_handler != deliver_child_signal)
7204 lib_child_handler = old_action.sa_handler;
7192} 7205}
7193 7206
7194 7207
@@ -7206,6 +7219,12 @@ init_process_emacs (void)
7206 if (! noninteractive || initialized) 7219 if (! noninteractive || initialized)
7207#endif 7220#endif
7208 { 7221 {
7222#if defined HAVE_GLIB && !defined WINDOWSNT
7223 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7224 this should always fail, but is enough to initialize glib's
7225 private SIGCHLD handler. */
7226 g_source_unref (g_child_watch_source_new (getpid ()));
7227#endif
7209 catch_child_signal (); 7228 catch_child_signal ();
7210 } 7229 }
7211 7230