aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/src/process.c b/src/process.c
index 3f062b6db16..b63a985fcec 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1685,7 +1685,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1685 1685
1686 block_input (); 1686 block_input ();
1687 block_child_signal (); 1687 block_child_signal ();
1688 catch_child_signal ();
1689 1688
1690#ifndef WINDOWSNT 1689#ifndef WINDOWSNT
1691 /* vfork, and prevent local vars from being clobbered by the vfork. */ 1690 /* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -7061,48 +7060,24 @@ integer or floating point values.
7061 futz with the SIGCHLD handler, but before Emacs forks any children. 7060 futz with the SIGCHLD handler, but before Emacs forks any children.
7062 This function's caller should block SIGCHLD. */ 7061 This function's caller should block SIGCHLD. */
7063 7062
7063#ifndef NS_IMPL_GNUSTEP
7064static
7065#endif
7064void 7066void
7065catch_child_signal (void) 7067catch_child_signal (void)
7066{ 7068{
7067 struct sigaction action, old_action; 7069 struct sigaction action, old_action;
7068
7069#if !defined CANNOT_DUMP
7070 if (noninteractive && !initialized)
7071 return;
7072#endif
7073
7074#ifndef NS_IMPL_GNUSTEP
7075 if (lib_child_handler)
7076 return;
7077#endif
7078
7079#if defined HAVE_GLIB && !defined WINDOWSNT
7080 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7081 this should always fail, but is enough to initialize glib's
7082 private SIGCHLD handler, allowing the code below to copy it into
7083 LIB_CHILD_HANDLER.
7084
7085 Do this here, rather than early in Emacs initialization where it
7086 might make more sense, to try to avoid bugs in Cygwin glib (Bug#14569). */
7087 {
7088 GSource *source = g_child_watch_source_new (getpid ());
7089 g_source_unref (source);
7090 }
7091#endif
7092
7093 emacs_sigaction_init (&action, deliver_child_signal); 7070 emacs_sigaction_init (&action, deliver_child_signal);
7071 block_child_signal ();
7094 sigaction (SIGCHLD, &action, &old_action); 7072 sigaction (SIGCHLD, &action, &old_action);
7095 eassert (! (old_action.sa_flags & SA_SIGINFO)); 7073 eassert (! (old_action.sa_flags & SA_SIGINFO));
7096 7074
7097#ifdef NS_IMPL_GNUSTEP 7075 if (old_action.sa_handler != deliver_child_signal)
7098 if (old_action.sa_handler == deliver_child_signal) 7076 lib_child_handler
7099 return; 7077 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
7100#endif 7078 ? dummy_handler
7101 7079 : old_action.sa_handler);
7102 lib_child_handler 7080 unblock_child_signal ();
7103 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
7104 ? dummy_handler
7105 : old_action.sa_handler);
7106} 7081}
7107 7082
7108 7083
@@ -7116,6 +7091,24 @@ init_process_emacs (void)
7116 7091
7117 inhibit_sentinels = 0; 7092 inhibit_sentinels = 0;
7118 7093
7094#ifndef CANNOT_DUMP
7095 if (! noninteractive || initialized)
7096#endif
7097 {
7098#if defined HAVE_GLIB && !defined WINDOWSNT && !defined CYGWIN
7099 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself;
7100 this should always fail, but is enough to initialize glib's
7101 private SIGCHLD handler, allowing the code below to copy it into
7102 LIB_CHILD_HANDLER.
7103
7104 For some reason tickling causes Cygwin bootstrap to fail, so it's
7105 skipped under Cygwin. FIXME: Skipping the tickling likely causes
7106 bugs in subprocess handling under Cygwin (Bug#14569). */
7107 g_source_unref (g_child_watch_source_new (getpid ()));
7108#endif
7109 catch_child_signal ();
7110 }
7111
7119 FD_ZERO (&input_wait_mask); 7112 FD_ZERO (&input_wait_mask);
7120 FD_ZERO (&non_keyboard_wait_mask); 7113 FD_ZERO (&non_keyboard_wait_mask);
7121 FD_ZERO (&non_process_wait_mask); 7114 FD_ZERO (&non_process_wait_mask);