]> code.delx.au - gnu-emacs/blob - src/syssignal.h
Delete #endif left over from previous change.
[gnu-emacs] / src / syssignal.h
1 /* syssignal.h - System-dependent definitions for signals.
2 Copyright (C) 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU Emacs.
5
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)
9 any later version.
10
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.
15
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. */
20
21 #ifdef POSIX_SIGNALS
22
23 /* Don't #include <signal.h>. That header should always be #included
24 before "config.h", because some configuration files (like s/hpux.h)
25 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file
26 #includes <signal.h>, then that will re-#define SIGIO and confuse
27 things. */
28
29 #define SIGMASKTYPE sigset_t
30
31 #define SIGEMPTYMASK (empty_mask)
32 #define SIGFULLMASK (full_mask)
33 extern sigset_t empty_mask, full_mask;
34
35 /* POSIX pretty much destroys any possibility of writing sigmask as a
36 macro in standard C. We always define our own version because the
37 predefined macro in Glibc 2.1 is only provided for compatility for old
38 programs that use int as signal mask type. */
39 #undef sigmask
40 #ifdef __GNUC__
41 #define sigmask(SIG) \
42 ({ \
43 sigset_t _mask; \
44 sigemptyset (&_mask); \
45 sigaddset (&_mask, SIG); \
46 _mask; \
47 })
48 #else /* ! defined (__GNUC__) */
49 extern sigset_t sys_sigmask ();
50 #define sigmask(SIG) (sys_sigmask (SIG))
51 #endif /* ! defined (__GNUC__) */
52
53 #undef sigpause
54 #define sigpause(MASK) sigsuspend (&(MASK))
55
56 #define sigblock(SIG) sys_sigblock (SIG)
57 #define sigunblock(SIG) sys_sigunblock (SIG)
58 #ifndef sigsetmask
59 #define sigsetmask(SIG) sys_sigsetmask (SIG)
60 #endif
61 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
62 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
63 #undef signal
64 #define signal(SIG,ACT) sys_signal(SIG,ACT)
65
66 /* Whether this is what all systems want or not, this is what
67 appears to be assumed in the source, for example data.c:arith_error. */
68 typedef RETSIGTYPE (*signal_handler_t) (/*int*/);
69
70 signal_handler_t sys_signal (/*int signal_number, signal_handler_t action*/);
71 sigset_t sys_sigblock (/*sigset_t new_mask*/);
72 sigset_t sys_sigunblock (/*sigset_t new_mask*/);
73 sigset_t sys_sigsetmask (/*sigset_t new_mask*/);
74
75 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
76
77 #else /* ! defined (POSIX_SIGNALS) */
78 #ifdef USG5_4
79
80 #ifndef sigblock
81 #define sigblock(sig) (sigprocmask (SIG_BLOCK, SIGEMPTYMASK | sig, NULL))
82 #endif
83
84 #define sigunblock(sig) (sigprocmask (SIG_SETMASK, SIGFULLMASK & ~(sig), NULL))
85
86 #else
87 #ifdef USG
88
89 #define sigunblock(sig)
90
91 #else
92
93 #define sigunblock(SIG) \
94 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
95
96 #endif /* ! defined (USG) */
97 #endif /* ! defined (USG5_4) */
98 #endif /* ! defined (POSIX_SIGNALS) */
99
100 #ifndef SIGMASKTYPE
101 #define SIGMASKTYPE int
102 #endif
103
104 #ifndef SIGEMPTYMASK
105 #define SIGEMPTYMASK (0)
106 #endif
107
108 #ifndef SIGFULLMASK
109 #define SIGFULLMASK (0xffffffff)
110 #endif
111
112 #ifndef sigmask
113 #define sigmask(no) (1L << ((no) - 1))
114 #endif
115
116 #ifndef sigunblock
117 #define sigunblock(SIG) \
118 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); }
119 #endif
120
121 #ifndef BSD4_1
122 #define sigfree() sigsetmask (SIGEMPTYMASK)
123 #endif /* not BSD4_1 */
124
125 #ifdef BSD4_1
126 #define SIGIO SIGTINT
127 /* sigfree is in sysdep.c */
128 #endif /* BSD4_1 */
129
130 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
131 Must do that using the killpg call. */
132 #ifdef BSD_SYSTEM
133 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
134 #else
135 #ifdef WINDOWSNT
136 #define EMACS_KILLPG(gid, signo) (kill (gid, signo))
137 #else
138 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
139 #endif
140 #endif
141
142 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
143 testing SIGCHLD. */
144 #ifndef VMS
145 #ifdef SIGCLD
146 #ifndef SIGCHLD
147 #define SIGCHLD SIGCLD
148 #endif /* SIGCHLD */
149 #endif /* ! defined (SIGCLD) */
150 #endif /* VMS */