summaryrefslogtreecommitdiff
path: root/src/syssignal.h
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1992-05-01 06:20:46 +0000
committerJim Blandy <jimb@redhat.com>1992-05-01 06:20:46 +0000
commit58dbe9703ad1b598d0e3b45fb917c13f979ee6b6 (patch)
tree4ba1c7bf06cc9b1f84d2148672475cb4caee1659 /src/syssignal.h
parent11d12b00fa218961e9ac962255739401c44aab08 (diff)
downloademacs-58dbe9703ad1b598d0e3b45fb917c13f979ee6b6.tar.gz
*** empty log message ***
Diffstat (limited to 'src/syssignal.h')
-rw-r--r--src/syssignal.h73
1 files changed, 48 insertions, 25 deletions
diff --git a/src/syssignal.h b/src/syssignal.h
index 81d52c8f758..cf5914458f2 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
#ifdef POSIX_SIGNALS
#define SIGMASKTYPE sigset_t
@@ -27,14 +28,19 @@ extern sigset_t empty_mask, full_mask, temp_mask;
#define sigmask(SIG) \
(sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask)
-/* May need a local mask. There could be problems if code using any
- of the 3 macros below could be reentered due to a signal occurring.
- This can't happen in Emacs 18.57, so we don't worry. - DJB
- These macros also require GCC. */
-#define sigpause(SIG) ({ sigset_t _mask; sys_sigpause(SIG); })
-#define sigblock(SIG) ({ sigset_t _mask; sys_sigblock(SIG); })
-#define sigunblock(SIG) ({ sigset_t _mask; sys_sigunblock(SIG); })
-#define sigsetmask(SIG) ({ sigset_t _mask; sys_sigsetmask(SIG); })
+/* The below routines may need a local mask. There could be problems
+ if code using any of the 3 macros below could be reentered due to a
+ signal occurring. This can't happen in Emacs 18.57, so we don't
+ worry. - DJB */
+
+#define EMACS_SIGPAUSE(sigset) \
+ do { sigset_t _mask; sys_sigpause (sigset); } while (0)
+#define EMACS_SIGBLOCK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigblock (new_sig); } while (0)
+#define EMACS_SIGUNBLOCK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigunblock (new_sig); } while (0)
+#define EMACS_SIGSETMASK(new_sig, old_sig) \
+ do { sigset_t _mask; (old_sig) = sys_sigsetmask (new_sig); } while (0)
#define sighold(SIG) ONLY_USED_IN_BSD_4_1
#define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
@@ -46,12 +52,12 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
-#else /* not POSIX_SIGNALS */
+#else /* ! defined (POSIX_SIGNALS) */
#define sigunblock(SIG) \
{ SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
-#endif /* not POSIX_SIGNALS */
+#endif /* ! defined (POSIX_SIGNALS) */
#ifndef SIGMASKTYPE
#define SIGMASKTYPE int
@@ -65,21 +71,38 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#define sigmask(no) (1L << ((no) - 1))
#endif
-#ifndef BSD4_1
-#define sigfree() sigsetmask (SIGEMPTYMASK)
-#define sigholdx(sig) sigsetmask (sigmask (sig))
-#define sigblockx(sig) sigblock (sigmask (sig))
-#define sigunblockx(sig) sigblock (SIGEMPTYMASK)
-#define sigpausex(sig) sigpause (0)
-#endif /* not BSD4_1 */
-
#ifdef BSD4_1
#define SIGIO SIGTINT
/* sigfree and sigholdx are in sysdep.c */
-#define sigblockx(sig) sighold (sig)
-#define sigunblockx(sig) sigrelse (sig)
-#define sigpausex(sig) sigpause (sig)
-#endif /* BSD4_1 */
+#define EMACS_SIGFREE () sigfree ()
+
+/* We define the following macros to expand into statements rather
+ than expressions, because the POSIX macros above do the same, and
+ we don't want people on BSD4_1 systems accidentally using the
+ macros in a way that will break the other systems. */
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+ do { (old_sig) = sigholdx (new_sig); } while (0)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+ do { (old_sig) = sighold (new_sig); } while (0)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+ do { (old_sig) = sigrelse (new_sig); } while (0)
+#define EMACS_SIGPAUSEX(sig) \
+ EMACS_SIGPAUSE (new_sig);
+
+#else /* ! defined (BSD4_1) */
+
+#define EMACS_SIGFREE() \
+ do { SIGMASKTYPE _dummy; EMACS_SIGSETMASK (SIGEMPTYMASK, _dummy); } while (0)
+#define EMACS_SIGHOLDX(new_sig, old_sig) \
+ EMACS_SIGSETMASK (sigmask (new_sig), old_sig)
+#define EMACS_SIGBLOCKX(new_sig, old_sig) \
+ EMACS_SIGBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGUNBLOCKX(new_sig, old_sig) \
+ EMACS_SIGUNBLOCK (sigmask (new_sig), old_sig)
+#define EMACS_SIGPAUSEX(sig) \
+ EMACS_SIGPAUSE (0)
+
+#endif /* ! defined (BSD4_1) */
/* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
Must do that using the killpg call. */
@@ -96,6 +119,6 @@ sigset_t sys_sigsetmask (sigset_t new_mask);
#ifdef SIGCLD
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
-#endif /* not SIGCHLD */
-#endif /* SIGCLD */
-#endif /* not VMS */
+#endif /* SIGCHLD */
+#endif /* ! defined (SIGCLD) */
+#endif /* VMS */