]>
code.delx.au - gnu-emacs/blob - src/syssignal.h
1 /* syssignal.h - System-dependent definitions for signals.
2 Copyright (C) 1992 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 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
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #define SIGMASKTYPE sigset_t
24 #define SIGEMPTYMASK (empty_mask)
25 #define SIGFULLMASK (full_mask)
26 extern sigset_t empty_mask
, full_mask
, temp_mask
;
28 #define sigmask(SIG) \
29 (sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask)
31 /* The below routines may need a local mask. There could be problems
32 if code using any of the 3 macros below could be reentered due to a
33 signal occurring. This can't happen in Emacs 18.57, so we don't
36 #define EMACS_SIGPAUSE(sigset) \
37 do { sigset_t _mask; sys_sigpause (sigset); } while (0)
38 #define EMACS_SIGBLOCK(new_sig, old_sig) \
39 do { sigset_t _mask; (old_sig) = sys_sigblock (new_sig); } while (0)
40 #define EMACS_SIGUNBLOCK(new_sig, old_sig) \
41 do { sigset_t _mask; (old_sig) = sys_sigunblock (new_sig); } while (0)
42 #define EMACS_SIGSETMASK(new_sig, old_sig) \
43 do { sigset_t _mask; (old_sig) = sys_sigsetmask (new_sig); } while (0)
44 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
45 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
47 int (*sys_signal (int signal_number
, int (*action
)())) ();
48 int sys_sigpause (int signal_number
);
49 sigset_t
sys_sigblock (sigset_t new_mask
);
50 sigset_t
sys_sigunblock (sigset_t new_mask
);
51 sigset_t
sys_sigsetmask (sigset_t new_mask
);
53 #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
55 #else /* ! defined (POSIX_SIGNALS) */
57 #define sigunblock(SIG) \
58 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
60 #endif /* ! defined (POSIX_SIGNALS) */
63 #define SIGMASKTYPE int
67 #define SIGEMPTYMASK 0
71 #define sigmask(no) (1L << ((no) - 1))
76 /* sigfree and sigholdx are in sysdep.c */
77 #define EMACS_SIGFREE () sigfree ()
79 /* We define the following macros to expand into statements rather
80 than expressions, because the POSIX macros above do the same, and
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);
92 #else /* ! defined (BSD4_1) */
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) \
105 #endif /* ! defined (BSD4_1) */
107 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
108 Must do that using the killpg call. */
110 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
112 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
115 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
121 #define SIGCHLD SIGCLD
123 #endif /* ! defined (SIGCLD) */