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/callproc.c | |
parent | 1edb4a2ec657c305880901e78317daf1990b5358 (diff) | |
download | emacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.gz emacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.bz2 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/callproc.c')
-rw-r--r-- | src/callproc.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/callproc.c b/src/callproc.c index 0831291b0dd..2147c173655 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -108,20 +108,20 @@ static Lisp_Object call_process (ptrdiff_t, Lisp_Object *, int, ptrdiff_t); /* Block SIGCHLD. */ void -block_child_signal (void) +block_child_signal (sigset_t *oldset) { sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); - pthread_sigmask (SIG_BLOCK, &blocked, 0); + pthread_sigmask (SIG_BLOCK, &blocked, oldset); } /* Unblock SIGCHLD. */ void -unblock_child_signal (void) +unblock_child_signal (sigset_t const *oldset) { - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); + pthread_sigmask (SIG_SETMASK, oldset, 0); } /* Return the current buffer's working directory, or the home @@ -162,7 +162,8 @@ encode_current_directory (void) void record_kill_process (struct Lisp_Process *p, Lisp_Object tempfile) { - block_child_signal (); + sigset_t oldset; + block_child_signal (&oldset); if (p->alive) { @@ -171,7 +172,7 @@ record_kill_process (struct Lisp_Process *p, Lisp_Object tempfile) kill (- p->pid, SIGKILL); } - unblock_child_signal (); + unblock_child_signal (&oldset); } /* Clean up files, file descriptors and processes created by Fcall_process. */ @@ -313,6 +314,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, char *tempfile = NULL; int pid; #else + sigset_t oldset; pid_t pid; #endif int child_errno; @@ -629,7 +631,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, #ifndef MSDOS block_input (); - block_child_signal (); + block_child_signal (&oldset); #ifdef WINDOWSNT pid = child_setup (filefd, fd_output, fd_error, new_argv, 0, current_dir); @@ -671,7 +673,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, if (pid == 0) { - unblock_child_signal (); + unblock_child_signal (&oldset); setsid (); @@ -707,7 +709,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, } } - unblock_child_signal (); + unblock_child_signal (&oldset); unblock_input (); #endif /* not MSDOS */ |