aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2014-03-25 07:43:26 -0700
committerPaul Eggert2014-03-25 07:43:26 -0700
commit1e952f0a7a1d0cc533438dcad37db08d8af6855f (patch)
tree423d42b20476efd08fa7c0e4b62756c1b09c8cdd /src/process.c
parent1edb4a2ec657c305880901e78317daf1990b5358 (diff)
downloademacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.gz
emacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.zip
Handle sigmask better with nested signal handlers.
* atimer.c (sigmask_atimers): Remove. Remaining use rewritten to use body of this function. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * sysdep.c (block_tty_out_signal, unblock_tty_out_signal): New arg OLDSET. All callers changed. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * keyboard.c (handle_interrupt): * sound.c (vox_configure, vox_close): Restore the old signal mask rather than unilaterally clearing bits from the mask, in case a handler is running within another handler. All callers changed. * lisp.h, process.c, process.h, term.c: Adjust decls and callers to match new API. * sysdep.c (emacs_sigaction_init): Don't worry about masking SIGFPE; signal handlers aren't supposed to use floating point anyway. (handle_arith_signal): Unblock just SIGFPE rather than clearing mask. Fixes: debbugs:15561
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c
index fd34eb08d9d..fe365a136de 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1663,6 +1663,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1663 bool pty_flag = 0; 1663 bool pty_flag = 0;
1664 char pty_name[PTY_NAME_SIZE]; 1664 char pty_name[PTY_NAME_SIZE];
1665 Lisp_Object lisp_pty_name = Qnil; 1665 Lisp_Object lisp_pty_name = Qnil;
1666 sigset_t oldset;
1666 1667
1667 inchannel = outchannel = -1; 1668 inchannel = outchannel = -1;
1668 1669
@@ -1728,7 +1729,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1728 setup_process_coding_systems (process); 1729 setup_process_coding_systems (process);
1729 1730
1730 block_input (); 1731 block_input ();
1731 block_child_signal (); 1732 block_child_signal (&oldset);
1732 1733
1733#ifndef WINDOWSNT 1734#ifndef WINDOWSNT
1734 /* vfork, and prevent local vars from being clobbered by the vfork. */ 1735 /* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -1852,7 +1853,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1852 signal (SIGPIPE, SIG_DFL); 1853 signal (SIGPIPE, SIG_DFL);
1853 1854
1854 /* Stop blocking SIGCHLD in the child. */ 1855 /* Stop blocking SIGCHLD in the child. */
1855 unblock_child_signal (); 1856 unblock_child_signal (&oldset);
1856 1857
1857 if (pty_flag) 1858 if (pty_flag)
1858 child_setup_tty (xforkout); 1859 child_setup_tty (xforkout);
@@ -1871,7 +1872,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1871 p->alive = 1; 1872 p->alive = 1;
1872 1873
1873 /* Stop blocking in the parent. */ 1874 /* Stop blocking in the parent. */
1874 unblock_child_signal (); 1875 unblock_child_signal (&oldset);
1875 unblock_input (); 1876 unblock_input ();
1876 1877
1877 if (pid < 0) 1878 if (pid < 0)
@@ -7070,8 +7071,9 @@ void
7070catch_child_signal (void) 7071catch_child_signal (void)
7071{ 7072{
7072 struct sigaction action, old_action; 7073 struct sigaction action, old_action;
7074 sigset_t oldset;
7073 emacs_sigaction_init (&action, deliver_child_signal); 7075 emacs_sigaction_init (&action, deliver_child_signal);
7074 block_child_signal (); 7076 block_child_signal (&oldset);
7075 sigaction (SIGCHLD, &action, &old_action); 7077 sigaction (SIGCHLD, &action, &old_action);
7076 eassert (! (old_action.sa_flags & SA_SIGINFO)); 7078 eassert (! (old_action.sa_flags & SA_SIGINFO));
7077 7079
@@ -7080,7 +7082,7 @@ catch_child_signal (void)
7080 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN 7082 = (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN
7081 ? dummy_handler 7083 ? dummy_handler
7082 : old_action.sa_handler); 7084 : old_action.sa_handler);
7083 unblock_child_signal (); 7085 unblock_child_signal (&oldset);
7084} 7086}
7085 7087
7086 7088