diff options
| author | Jim Blandy | 1992-05-10 18:13:22 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-05-10 18:13:22 +0000 |
| commit | 1b1f8f85bf08bd6b1cdb5ca8d731ff3b12ff60d2 (patch) | |
| tree | 8828593443616e8a4cf61b61481ec2e1ce00f3fe /src | |
| parent | 19ed208b56cf422800d2150fd4402953575ad054 (diff) | |
| download | emacs-1b1f8f85bf08bd6b1cdb5ca8d731ff3b12ff60d2.tar.gz emacs-1b1f8f85bf08bd6b1cdb5ca8d731ff3b12ff60d2.zip | |
entered into RCS
Diffstat (limited to 'src')
| -rw-r--r-- | src/syssignal.h | 100 |
1 files changed, 47 insertions, 53 deletions
diff --git a/src/syssignal.h b/src/syssignal.h index cf5914458f2..486f9efd623 100644 --- a/src/syssignal.h +++ b/src/syssignal.h | |||
| @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License | |||
| 17 | along with GNU Emacs; see the file COPYING. If not, write to | 17 | along with GNU Emacs; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 19 | 19 | ||
| 20 | |||
| 21 | #ifdef POSIX_SIGNALS | 20 | #ifdef POSIX_SIGNALS |
| 22 | #define SIGMASKTYPE sigset_t | 21 | #define SIGMASKTYPE sigset_t |
| 23 | 22 | ||
| @@ -25,22 +24,24 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 25 | #define SIGFULLMASK (full_mask) | 24 | #define SIGFULLMASK (full_mask) |
| 26 | extern sigset_t empty_mask, full_mask, temp_mask; | 25 | extern sigset_t empty_mask, full_mask, temp_mask; |
| 27 | 26 | ||
| 28 | #define sigmask(SIG) \ | 27 | /* POSIX pretty much destroys any possibility of writing sigmask as a |
| 29 | (sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask) | 28 | macro in standard C. */ |
| 30 | 29 | #ifdef __GNUC__ | |
| 31 | /* The below routines may need a local mask. There could be problems | 30 | #define sigmask(SIG) \ |
| 32 | if code using any of the 3 macros below could be reentered due to a | 31 | ({ \ |
| 33 | signal occurring. This can't happen in Emacs 18.57, so we don't | 32 | sigset_t _mask; \ |
| 34 | worry. - DJB */ | 33 | sigemptyset (&_mask); \ |
| 35 | 34 | sigaddset (&_mask, SIG); \ | |
| 36 | #define EMACS_SIGPAUSE(sigset) \ | 35 | _mask; \ |
| 37 | do { sigset_t _mask; sys_sigpause (sigset); } while (0) | 36 | }) |
| 38 | #define EMACS_SIGBLOCK(new_sig, old_sig) \ | 37 | #else |
| 39 | do { sigset_t _mask; (old_sig) = sys_sigblock (new_sig); } while (0) | 38 | #define sigmask(SIG) (sys_sigmask (SIG)) |
| 40 | #define EMACS_SIGUNBLOCK(new_sig, old_sig) \ | 39 | #endif |
| 41 | do { sigset_t _mask; (old_sig) = sys_sigunblock (new_sig); } while (0) | 40 | |
| 42 | #define EMACS_SIGSETMASK(new_sig, old_sig) \ | 41 | #define sigpause(SIG) sys_sigpause(SIG) |
| 43 | do { sigset_t _mask; (old_sig) = sys_sigsetmask (new_sig); } while (0) | 42 | #define sigblock(SIG) sys_sigblock(SIG) |
| 43 | #define sigunblock(SIG) sys_sigunblock(SIG) | ||
| 44 | #define sigsetmask(SIG) sys_sigsetmask(SIG) | ||
| 44 | #define sighold(SIG) ONLY_USED_IN_BSD_4_1 | 45 | #define sighold(SIG) ONLY_USED_IN_BSD_4_1 |
| 45 | #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1 | 46 | #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1 |
| 46 | 47 | ||
| @@ -52,57 +53,51 @@ sigset_t sys_sigsetmask (sigset_t new_mask); | |||
| 52 | 53 | ||
| 53 | #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG) | 54 | #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG) |
| 54 | 55 | ||
| 55 | #else /* ! defined (POSIX_SIGNALS) */ | 56 | #else /* not POSIX_SIGNALS */ |
| 56 | 57 | ||
| 57 | #define sigunblock(SIG) \ | 58 | #define sigunblock(SIG) \ |
| 58 | { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } | 59 | { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } |
| 59 | 60 | ||
| 60 | #endif /* ! defined (POSIX_SIGNALS) */ | 61 | #endif /* not POSIX_SIGNALS */ |
| 61 | 62 | ||
| 62 | #ifndef SIGMASKTYPE | 63 | #ifndef SIGMASKTYPE |
| 63 | #define SIGMASKTYPE int | 64 | #define SIGMASKTYPE int |
| 64 | #endif | 65 | #endif |
| 65 | 66 | ||
| 66 | #ifndef SIGEMPTYMASK | 67 | #ifndef SIGEMPTYMASK |
| 67 | #define SIGEMPTYMASK 0 | 68 | #define SIGEMPTYMASK (0) |
| 69 | #endif | ||
| 70 | |||
| 71 | #ifndef SIGFULLMASK | ||
| 72 | #define SIGFULLMASK (0xffffffff) | ||
| 68 | #endif | 73 | #endif |
| 69 | 74 | ||
| 70 | #ifndef sigmask | 75 | #ifndef sigmask |
| 71 | #define sigmask(no) (1L << ((no) - 1)) | 76 | #define sigmask(no) (1L << ((no) - 1)) |
| 72 | #endif | 77 | #endif |
| 73 | 78 | ||
| 79 | #ifndef sigunblock | ||
| 80 | #define sigunblock(SIG) \ | ||
| 81 | { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); } | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* It would be very nice if we could somehow clean up all this trash. */ | ||
| 85 | |||
| 86 | #ifndef BSD4_1 | ||
| 87 | #define sigfree() sigsetmask (SIGEMPTYMASK) | ||
| 88 | #define sigholdx(sig) sigsetmask (sigmask (sig)) | ||
| 89 | #define sigblockx(sig) sigblock (sigmask (sig)) | ||
| 90 | #define sigunblockx(sig) sigblock (SIGEMPTYMASK) | ||
| 91 | #define sigpausex(sig) sigpause (0) | ||
| 92 | #endif /* not BSD4_1 */ | ||
| 93 | |||
| 74 | #ifdef BSD4_1 | 94 | #ifdef BSD4_1 |
| 75 | #define SIGIO SIGTINT | 95 | #define SIGIO SIGTINT |
| 76 | /* sigfree and sigholdx are in sysdep.c */ | 96 | /* sigfree and sigholdx are in sysdep.c */ |
| 77 | #define EMACS_SIGFREE () sigfree () | 97 | #define sigblockx(sig) sighold (sig) |
| 78 | 98 | #define sigunblockx(sig) sigrelse (sig) | |
| 79 | /* We define the following macros to expand into statements rather | 99 | #define sigpausex(sig) sigpause (sig) |
| 80 | than expressions, because the POSIX macros above do the same, and | 100 | #endif /* BSD4_1 */ |
| 81 | we don't want people on BSD4_1 systems accidentally using the | ||
| 82 | macros in a way that will break the other systems. */ | ||
| 83 | #define EMACS_SIGHOLDX(new_sig, old_sig) \ | ||
| 84 | do { (old_sig) = sigholdx (new_sig); } while (0) | ||
| 85 | #define EMACS_SIGBLOCKX(new_sig, old_sig) \ | ||
| 86 | do { (old_sig) = sighold (new_sig); } while (0) | ||
| 87 | #define EMACS_SIGUNBLOCKX(new_sig, old_sig) \ | ||
| 88 | do { (old_sig) = sigrelse (new_sig); } while (0) | ||
| 89 | #define EMACS_SIGPAUSEX(sig) \ | ||
| 90 | EMACS_SIGPAUSE (new_sig); | ||
| 91 | |||
| 92 | #else /* ! defined (BSD4_1) */ | ||
| 93 | |||
| 94 | #define EMACS_SIGFREE() \ | ||
| 95 | do { SIGMASKTYPE _dummy; EMACS_SIGSETMASK (SIGEMPTYMASK, _dummy); } while (0) | ||
| 96 | #define EMACS_SIGHOLDX(new_sig, old_sig) \ | ||
| 97 | EMACS_SIGSETMASK (sigmask (new_sig), old_sig) | ||
| 98 | #define EMACS_SIGBLOCKX(new_sig, old_sig) \ | ||
| 99 | EMACS_SIGBLOCK (sigmask (new_sig), old_sig) | ||
| 100 | #define EMACS_SIGUNBLOCKX(new_sig, old_sig) \ | ||
| 101 | EMACS_SIGUNBLOCK (sigmask (new_sig), old_sig) | ||
| 102 | #define EMACS_SIGPAUSEX(sig) \ | ||
| 103 | EMACS_SIGPAUSE (0) | ||
| 104 | |||
| 105 | #endif /* ! defined (BSD4_1) */ | ||
| 106 | 101 | ||
| 107 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | 102 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. |
| 108 | Must do that using the killpg call. */ | 103 | Must do that using the killpg call. */ |
| @@ -114,11 +109,10 @@ sigset_t sys_sigsetmask (sigset_t new_mask); | |||
| 114 | 109 | ||
| 115 | /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | 110 | /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals |
| 116 | testing SIGCHLD. */ | 111 | testing SIGCHLD. */ |
| 117 | |||
| 118 | #ifndef VMS | 112 | #ifndef VMS |
| 119 | #ifdef SIGCLD | 113 | #ifdef SIGCLD |
| 120 | #ifndef SIGCHLD | 114 | #ifndef SIGCHLD |
| 121 | #define SIGCHLD SIGCLD | 115 | #define SIGCHLD SIGCLD |
| 122 | #endif /* SIGCHLD */ | 116 | #endif /* not SIGCHLD */ |
| 123 | #endif /* ! defined (SIGCLD) */ | 117 | #endif /* SIGCLD */ |
| 124 | #endif /* VMS */ | 118 | #endif /* not VMS */ |