From 123403e42f1a1d556fb33cfd60cbec124d740837 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 6 Jul 2011 11:04:23 -0700 Subject: [PATCH] Use pthread_sigmask, not sigprocmask. * callproc.c (Fcall_process): * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask): * process.c (create_process): sigprocmask is portable only for single-threaded applications, and Emacs can be multi-threaded when it uses GTK. --- src/ChangeLog | 9 +++++++++ src/callproc.c | 6 +++--- src/process.c | 6 +++--- src/sysdep.c | 6 +++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index dc62da2035b..9c73cb9ed85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2011-07-06 Paul Eggert + + Use pthread_sigmask, not sigprocmask. + * callproc.c (Fcall_process): + * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask): + * process.c (create_process): + sigprocmask is portable only for single-threaded applications, and + Emacs can be multi-threaded when it uses GTK. + 2011-07-05 Jan Djärv * xsettings.c: Use both GConf and GSettings if both are available. diff --git a/src/callproc.c b/src/callproc.c index b339f343f62..ad3eddbdd39 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -596,7 +596,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) sigemptyset (&blocked); sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action); - sigprocmask (SIG_BLOCK, &blocked, &procmask); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); #endif BLOCK_INPUT; @@ -633,7 +633,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) in the child. */ //signal (SIGPIPE, SIG_DFL); #ifdef HAVE_WORKING_VFORK - sigprocmask (SIG_SETMASK, &procmask, 0); + pthread_sigmask (SIG_SETMASK, &procmask, 0); #endif child_setup (filefd, fd1, fd_error, (char **) new_argv, @@ -645,7 +645,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) #ifdef HAVE_WORKING_VFORK /* Restore the signal state. */ sigaction (SIGPIPE, &sigpipe_action, 0); - sigprocmask (SIG_SETMASK, &procmask, 0); + pthread_sigmask (SIG_SETMASK, &procmask, 0); #endif #endif /* not WINDOWSNT */ diff --git a/src/process.c b/src/process.c index 6bd168d8840..1a884357b86 100644 --- a/src/process.c +++ b/src/process.c @@ -1652,7 +1652,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action ); #endif #endif /* HAVE_WORKING_VFORK */ - sigprocmask (SIG_BLOCK, &blocked, &procmask); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); FD_SET (inchannel, &input_wait_mask); FD_SET (inchannel, &non_keyboard_wait_mask); @@ -1808,7 +1808,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) signal (SIGPIPE, SIG_DFL); /* Stop blocking signals in the child. */ - sigprocmask (SIG_SETMASK, &procmask, 0); + pthread_sigmask (SIG_SETMASK, &procmask, 0); if (pty_flag) child_setup_tty (xforkout); @@ -1900,7 +1900,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) #endif #endif /* HAVE_WORKING_VFORK */ /* Stop blocking signals in the parent. */ - sigprocmask (SIG_SETMASK, &procmask, 0); + pthread_sigmask (SIG_SETMASK, &procmask, 0); /* Now generate the error if vfork failed. */ if (pid < 0) diff --git a/src/sysdep.c b/src/sysdep.c index 8b6939b91fe..46667cf292f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1534,7 +1534,7 @@ sigset_t sys_sigblock (sigset_t new_mask) { sigset_t old_mask; - sigprocmask (SIG_BLOCK, &new_mask, &old_mask); + pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask); return (old_mask); } @@ -1542,7 +1542,7 @@ sigset_t sys_sigunblock (sigset_t new_mask) { sigset_t old_mask; - sigprocmask (SIG_UNBLOCK, &new_mask, &old_mask); + pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask); return (old_mask); } @@ -1550,7 +1550,7 @@ sigset_t sys_sigsetmask (sigset_t new_mask) { sigset_t old_mask; - sigprocmask (SIG_SETMASK, &new_mask, &old_mask); + pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask); return (old_mask); } -- 2.39.2