1 /* syssignal.h - System-dependent definitions for signals.
2 Copyright (C) 1993, 1999 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 2, 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, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 extern void init_signals
P_ ((void));
25 /* Don't #include <signal.h>. That header should always be #included
26 before "config.h", because some configuration files (like s/hpux.h)
27 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file
28 #includes <signal.h>, then that will re-#define SIGIO and confuse
31 #define SIGMASKTYPE sigset_t
33 #define SIGEMPTYMASK (empty_mask)
34 #define SIGFULLMASK (full_mask)
35 extern sigset_t empty_mask
, full_mask
;
37 /* POSIX pretty much destroys any possibility of writing sigmask as a
38 macro in standard C. We always define our own version because the
39 predefined macro in Glibc 2.1 is only provided for compatility for old
40 programs that use int as signal mask type. */
43 #define sigmask(SIG) \
46 sigemptyset (&_mask); \
47 sigaddset (&_mask, SIG); \
50 #else /* ! defined (__GNUC__) */
51 extern sigset_t
sys_sigmask ();
52 #define sigmask(SIG) (sys_sigmask (SIG))
53 #endif /* ! defined (__GNUC__) */
56 #define sigpause(MASK) sigsuspend (&(MASK))
58 #define sigblock(SIG) sys_sigblock (SIG)
59 #define sigunblock(SIG) sys_sigunblock (SIG)
61 #define sigsetmask(SIG) sys_sigsetmask (SIG)
63 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
64 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
66 #define signal(SIG,ACT) sys_signal(SIG,ACT)
68 /* Whether this is what all systems want or not, this is what
69 appears to be assumed in the source, for example data.c:arith_error. */
70 typedef RETSIGTYPE (*signal_handler_t
) (/*int*/);
72 signal_handler_t sys_signal
P_ ((int signal_number
, signal_handler_t action
));
73 sigset_t sys_sigblock
P_ ((sigset_t new_mask
));
74 sigset_t sys_sigunblock
P_ ((sigset_t new_mask
));
75 sigset_t sys_sigsetmask
P_ ((sigset_t new_mask
));
77 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
79 #else /* ! defined (POSIX_SIGNALS) */
82 extern SIGMASKTYPE sigprocmask_set
;
85 #define sigblock(sig) \
86 (sigprocmask_set = SIGEMPTYMASK | (sig), \
87 sigprocmask (SIG_BLOCK, &sigprocmask_set, NULL))
91 #define sigunblock(sig) \
92 (sigprocmask_set = SIGFULLMASK & ~(sig), \
93 sigprocmask (SIG_SETMASK, &sigprocmask_set, NULL))
100 #define sigunblock(sig)
106 #define sigunblock(SIG) \
107 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
110 #endif /* ! defined (USG) */
111 #endif /* ! defined (USG5_4) */
112 #endif /* ! defined (POSIX_SIGNALS) */
115 #define SIGMASKTYPE int
119 #define SIGEMPTYMASK (0)
123 #define SIGFULLMASK (0xffffffff)
127 #define sigmask(no) (1L << ((no) - 1))
131 #define sigunblock(SIG) \
132 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); }
136 #define sigfree() sigsetmask (SIGEMPTYMASK)
137 #endif /* not BSD4_1 */
139 #if defined (SIGINFO) && defined (BROKEN_SIGINFO)
142 #if defined (SIGIO) && defined (BROKEN_SIGIO)
145 #if defined (SIGPOLL) && defined (BROKEN_SIGPOLL)
148 #if defined (SIGTSTP) && defined (BROKEN_SIGTSTP)
151 #if defined (SIGURG) && defined (BROKEN_SIGURG)
154 #if defined (SIGAIO) && defined (BROKEN_SIGAIO)
157 #if defined (SIGPTY) && defined (BROKEN_SIGPTY)
162 #if NSIG < NSIG_MINIMUM
166 # define NSIG NSIG_MINIMUM
170 #define SIGIO SIGTINT
171 /* sigfree is in sysdep.c */
174 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
175 Must do that using the killpg call. */
177 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
180 #define EMACS_KILLPG(gid, signo) (kill (gid, signo))
182 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
186 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
191 #define SIGCHLD SIGCLD
193 #endif /* ! defined (SIGCLD) */
196 #ifndef HAVE_STRSIGNAL
197 /* strsignal is in sysdep.c */
201 /* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152
202 (do not change this comment) */