diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-03-25 07:43:26 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-03-25 07:43:26 -0700 |
commit | 1e952f0a7a1d0cc533438dcad37db08d8af6855f (patch) | |
tree | 423d42b20476efd08fa7c0e4b62756c1b09c8cdd /src/sysdep.c | |
parent | 1edb4a2ec657c305880901e78317daf1990b5358 (diff) | |
download | emacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.gz |
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/sysdep.c')
-rw-r--r-- | src/sysdep.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index 6ec8eecb287..af9f4801cec 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -692,21 +692,21 @@ init_foreground_group (void) /* Block and unblock SIGTTOU. */ void -block_tty_out_signal (void) +block_tty_out_signal (sigset_t *oldset) { #ifdef SIGTTOU sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGTTOU); - pthread_sigmask (SIG_BLOCK, &blocked, 0); + pthread_sigmask (SIG_BLOCK, &blocked, oldset); #endif } void -unblock_tty_out_signal (void) +unblock_tty_out_signal (sigset_t const *oldset) { #ifdef SIGTTOU - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); + pthread_sigmask (SIG_SETMASK, oldset, 0); #endif } @@ -721,10 +721,11 @@ static void tcsetpgrp_without_stopping (int fd, pid_t pgid) { #ifdef SIGTTOU + sigset_t oldset; block_input (); - block_tty_out_signal (); + block_tty_out_signal (&oldset); tcsetpgrp (fd, pgid); - unblock_tty_out_signal (); + unblock_tty_out_signal (&oldset); unblock_input (); #endif } @@ -1525,9 +1526,6 @@ emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) #endif } - if (! IEEE_FLOATING_POINT) - sigaddset (&action->sa_mask, SIGFPE); - action->sa_handler = handler; action->sa_flags = emacs_sigaction_flags (); } @@ -1643,7 +1641,10 @@ deliver_fatal_thread_signal (int sig) static _Noreturn void handle_arith_signal (int sig) { - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, sig); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); xsignal0 (Qarith_error); } |