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. */
21 #define SIGMASKTYPE sigset_t
23 #define SIGEMPTYMASK (empty_mask)
24 #define SIGFULLMASK (full_mask)
25 extern sigset_t empty_mask
, full_mask
, temp_mask
;
27 /* POSIX pretty much destroys any possibility of writing sigmask as a
28 macro in standard C. */
30 #define sigmask(SIG) \
33 sigemptyset (&_mask); \
34 sigaddset (&_mask, SIG); \
37 #else /* ! defined (__GNUC__) */
38 #define sigmask(SIG) (sys_sigmask (SIG))
39 #endif /* ! defined (__GNUC__) */
41 #define sigpause(SIG) sys_sigpause(SIG)
42 #define sigblock(SIG) sys_sigblock(SIG)
43 #define sigunblock(SIG) sys_sigunblock(SIG)
44 #define sigsetmask(SIG) sys_sigsetmask(SIG)
45 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
46 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
48 int (*sys_signal (int signal_number
, int (*action
)())) ();
49 int sys_sigpause (int signal_number
);
50 sigset_t
sys_sigblock (sigset_t new_mask
);
51 sigset_t
sys_sigunblock (sigset_t new_mask
);
52 sigset_t
sys_sigsetmask (sigset_t new_mask
);
54 #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
56 #else /* ! defined (POSIX_SIGNALS) */
59 #define sigunblock(sig) (sigprocmask(SIG_SETMASK, SIGFULLMASK & ~(sig), NULL))
64 #define sigunblock(sig)
68 #define sigunblock(SIG) \
69 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
71 #endif /* ! defined (USG) */
72 #endif /* ! defined (USG5_4) */
73 #endif /* ! defined (POSIX_SIGNALS) */
76 #define SIGMASKTYPE int
80 #define SIGEMPTYMASK (0)
84 #define SIGFULLMASK (0xffffffff)
88 #define sigmask(no) (1L << ((no) - 1))
92 #define sigunblock(SIG) \
93 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); }
96 /* It would be very nice if we could somehow clean up all this trash. */
99 #define sigfree() sigsetmask (SIGEMPTYMASK)
100 #define sigholdx(sig) sigsetmask (sigmask (sig))
101 #define sigblockx(sig) sigblock (sigmask (sig))
102 #define sigunblockx(sig) sigblock (SIGEMPTYMASK)
103 #define sigpausex(sig) sigpause (0)
107 #define SIGIO SIGTINT
108 /* sigfree and sigholdx are in sysdep.c */
109 #define sigblockx(sig) sighold (sig)
110 #define sigunblockx(sig) sigrelse (sig)
111 #define sigpausex(sig) sigpause (sig)
112 #endif /* ! defined (BSD4_1) */
114 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
115 Must do that using the killpg call. */
117 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
119 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
122 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
127 #define SIGCHLD SIGCLD
129 #endif /* ! defined (SIGCLD) */