aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/callproc.c4
-rw-r--r--src/emacs.c7
-rw-r--r--src/process.c2
-rw-r--r--src/process.h2
-rw-r--r--src/sysdep.c2
6 files changed, 25 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 202331dac53..b2773ddbf50 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12013-06-23 Paul Eggert <eggert@cs.ucla.edu>
2
3 Try to avoid malloc SEGVs on Cygwin (Bug#14569).
4 * callproc.c, process.h (block_child_signal, unblock_child_signal):
5 Now extern.
6 * emacs.c (main): Catch SIGCHLD just before initializing gfilenotify.
7 * process.c (catch_child_signal): Block SIGCHLD while futzing with
8 the SIGCHLD handler, since the code is not atomic and (due to glib)
9 signals may be arriving now.
10 * sysdep.c (init_signals): Do not catch child signals here;
11 'main' now does that later, at a safer time.
12
12013-06-22 Paul Eggert <eggert@cs.ucla.edu> 132013-06-22 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 Clean up SIGCHLD handling a bit (Bug#14569). 15 Clean up SIGCHLD handling a bit (Bug#14569).
diff --git a/src/callproc.c b/src/callproc.c
index 745d58c45f4..f0aa8222342 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -84,7 +84,7 @@ static int synch_process_fd;
84 84
85/* Block SIGCHLD. */ 85/* Block SIGCHLD. */
86 86
87static void 87void
88block_child_signal (void) 88block_child_signal (void)
89{ 89{
90 sigset_t blocked; 90 sigset_t blocked;
@@ -95,7 +95,7 @@ block_child_signal (void)
95 95
96/* Unblock SIGCHLD. */ 96/* Unblock SIGCHLD. */
97 97
98static void 98void
99unblock_child_signal (void) 99unblock_child_signal (void)
100{ 100{
101 pthread_sigmask (SIG_SETMASK, &empty_mask, 0); 101 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
diff --git a/src/emacs.c b/src/emacs.c
index 13f6d117ebc..c5b32c7c0e7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1257,6 +1257,13 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1257 tzset (); 1257 tzset ();
1258#endif /* MSDOS */ 1258#endif /* MSDOS */
1259 1259
1260 /* Do this after initializing the memory allocator, since it uses
1261 glib and glib uses malloc. And do it before anything else that
1262 invokes glib, to avoid potential races among glib subthreads in
1263 Cygwin glib. gfilenotify invokes glib, so this can't be delayed
1264 further. */
1265 catch_child_signal ();
1266
1260#ifdef HAVE_GFILENOTIFY 1267#ifdef HAVE_GFILENOTIFY
1261 globals_of_gfilenotify (); 1268 globals_of_gfilenotify ();
1262#endif 1269#endif
diff --git a/src/process.c b/src/process.c
index 3e31dede4c2..6df1bf7eff7 100644
--- a/src/process.c
+++ b/src/process.c
@@ -7084,11 +7084,13 @@ catch_child_signal (void)
7084#endif 7084#endif
7085 7085
7086 emacs_sigaction_init (&action, deliver_child_signal); 7086 emacs_sigaction_init (&action, deliver_child_signal);
7087 block_child_signal ();
7087 sigaction (SIGCHLD, &action, &old_action); 7088 sigaction (SIGCHLD, &action, &old_action);
7088 eassert (! (old_action.sa_flags & SA_SIGINFO)); 7089 eassert (! (old_action.sa_flags & SA_SIGINFO));
7089 if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN 7090 if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN
7090 && old_action.sa_handler != deliver_child_signal) 7091 && old_action.sa_handler != deliver_child_signal)
7091 lib_child_handler = old_action.sa_handler; 7092 lib_child_handler = old_action.sa_handler;
7093 unblock_child_signal ();
7092} 7094}
7093 7095
7094 7096
diff --git a/src/process.h b/src/process.h
index 9455df18beb..3f86e5f3945 100644
--- a/src/process.h
+++ b/src/process.h
@@ -200,6 +200,8 @@ extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
200 200
201/* Defined in callproc.c. */ 201/* Defined in callproc.c. */
202 202
203extern void block_child_signal (void);
204extern void unblock_child_signal (void);
203extern void record_kill_process (struct Lisp_Process *); 205extern void record_kill_process (struct Lisp_Process *);
204 206
205/* Defined in process.c. */ 207/* Defined in process.c. */
diff --git a/src/sysdep.c b/src/sysdep.c
index c2769865b5d..1d3e646d359 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1901,8 +1901,6 @@ init_signals (bool dumping)
1901 sigaction (SIGFPE, &action, 0); 1901 sigaction (SIGFPE, &action, 0);
1902 } 1902 }
1903 1903
1904 catch_child_signal ();
1905
1906#ifdef SIGUSR1 1904#ifdef SIGUSR1
1907 add_user_signal (SIGUSR1, "sigusr1"); 1905 add_user_signal (SIGUSR1, "sigusr1");
1908#endif 1906#endif