diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 21 |
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. */) might inadvertently reap a GTK-created process that happened to have the same process ID. */ +/* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing + its own SIGCHLD handling. On POSIXish systems, glib needs this to + keep track of its own children. The default handler does nothing. */ +static void dummy_handler (int sig) {} +static signal_handler_t volatile lib_child_handler = dummy_handler; + /* Handle a SIGCHLD signal by looking for known child processes of Emacs whose status have changed. For each one found, record its new status. @@ -6184,6 +6190,8 @@ handle_child_signal (int sig) } } } + + lib_child_handler (sig); } static void @@ -7035,9 +7043,13 @@ static void catch_child_signal (void) { - struct sigaction action; + struct sigaction action, old_action; emacs_sigaction_init (&action, deliver_child_signal); - sigaction (SIGCHLD, &action, 0); + sigaction (SIGCHLD, &action, &old_action); + eassert (! (old_action.sa_flags & SA_SIGINFO)); + if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN + && old_action.sa_handler != deliver_child_signal) + lib_child_handler = old_action.sa_handler; } @@ -7055,6 +7067,11 @@ init_process_emacs (void) if (! noninteractive || initialized) #endif { +#if defined HAVE_GLIB && !defined WINDOWSNT + /* Tickle glib's child-handling code so that it initializes its + private SIGCHLD handler. */ + g_source_unref (g_child_watch_source_new (0)); +#endif catch_child_signal (); } |
