(HAVE_LOGB, HAVE_FREXP, HAVE_FMOD, HAVE_RINT):
[emacs.git] / src / syssignal.h
blob23a15c6c1d2960094b127fed13ce5cb6ad387058
1 /* syssignal.h - System-dependent definitions for signals.
2 Copyright (C) 1993 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)
9 any later version.
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 #ifdef POSIX_SIGNALS
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. */
29 #define SIGMASKTYPE sigset_t
31 #define SIGEMPTYMASK (empty_mask)
32 #define SIGFULLMASK (full_mask)
33 extern sigset_t empty_mask, full_mask, temp_mask;
35 /* POSIX pretty much destroys any possibility of writing sigmask as a
36 macro in standard C. */
37 #ifndef sigmask
38 #ifdef __GNUC__
39 #define sigmask(SIG) \
40 ({ \
41 sigset_t _mask; \
42 sigemptyset (&_mask); \
43 sigaddset (&_mask, SIG); \
44 _mask; \
46 #else /* ! defined (__GNUC__) */
47 extern sigset_t sys_sigmask ();
48 #define sigmask(SIG) (sys_sigmask (SIG))
49 #endif /* ! defined (__GNUC__) */
50 #endif
52 #ifndef sigpause
53 #define sigpause(SIG) sys_sigpause (SIG)
54 #else
55 /* If sigpause is predefined, with POSIX_SIGNALS,
56 let's assume it needs this kind of argument.
57 This is true for Glibc 2.1. */
58 #undef SIGEMPTYMASK
59 #define SIGEMPTYMASK sigmask (0)
60 #endif
62 #define sigblock(SIG) sys_sigblock (SIG)
63 #define sigunblock(SIG) sys_sigunblock (SIG)
64 #ifndef sigsetmask
65 #define sigsetmask(SIG) sys_sigsetmask (SIG)
66 #endif
67 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
68 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
69 #undef signal
70 #define signal(SIG,ACT) sys_signal(SIG,ACT)
72 /* Whether this is what all systems want or not, this is what
73 appears to be assumed in the source, for example data.c:arith_error. */
74 typedef RETSIGTYPE (*signal_handler_t) (/*int*/);
76 signal_handler_t sys_signal (/*int signal_number, signal_handler_t action*/);
77 int sys_sigpause (/*sigset_t new_mask*/);
78 sigset_t sys_sigblock (/*sigset_t new_mask*/);
79 sigset_t sys_sigunblock (/*sigset_t new_mask*/);
80 sigset_t sys_sigsetmask (/*sigset_t new_mask*/);
82 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
84 #else /* ! defined (POSIX_SIGNALS) */
85 #ifdef USG5_4
87 #ifndef sigblock
88 #define sigblock(sig) (sigprocmask (SIG_BLOCK, SIGEMPTYMASK | sig, NULL))
89 #endif
91 #define sigunblock(sig) (sigprocmask (SIG_SETMASK, SIGFULLMASK & ~(sig), NULL))
93 #else
94 #ifdef USG
96 #define sigunblock(sig)
98 #else
100 #define sigunblock(SIG) \
101 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
103 #endif /* ! defined (USG) */
104 #endif /* ! defined (USG5_4) */
105 #endif /* ! defined (POSIX_SIGNALS) */
107 #ifndef SIGMASKTYPE
108 #define SIGMASKTYPE int
109 #endif
111 #ifndef SIGEMPTYMASK
112 #define SIGEMPTYMASK (0)
113 #endif
115 #ifndef SIGFULLMASK
116 #define SIGFULLMASK (0xffffffff)
117 #endif
119 #ifndef sigmask
120 #define sigmask(no) (1L << ((no) - 1))
121 #endif
123 #ifndef sigunblock
124 #define sigunblock(SIG) \
125 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); }
126 #endif
128 #ifndef BSD4_1
129 #define sigfree() sigsetmask (SIGEMPTYMASK)
130 #endif /* not BSD4_1 */
132 #ifdef BSD4_1
133 #define SIGIO SIGTINT
134 /* sigfree is in sysdep.c */
135 #endif /* BSD4_1 */
137 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
138 Must do that using the killpg call. */
139 #ifdef BSD_SYSTEM
140 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
141 #else
142 #ifdef WINDOWSNT
143 #define EMACS_KILLPG(gid, signo) (kill (gid, signo))
144 #else
145 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
146 #endif
147 #endif
149 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
150 testing SIGCHLD. */
151 #ifndef VMS
152 #ifdef SIGCLD
153 #ifndef SIGCHLD
154 #define SIGCHLD SIGCLD
155 #endif /* SIGCHLD */
156 #endif /* ! defined (SIGCLD) */
157 #endif /* VMS */