Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / os_include / os_signal.h
blob9574506019db1709cf61a04fbdf6b089922ee507
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file os_signal.h
7 * signals
9 * $Id: os_signal.h 80826 2008-03-04 14:51:23Z wotte $
11 * @author Don Hinton <dhinton@dresystems.com>
12 * @author This code was originally in various places including ace/OS.h.
14 //=============================================================================
16 #ifndef ACE_OS_INCLUDE_OS_SIGNAL_H
17 #define ACE_OS_INCLUDE_OS_SIGNAL_H
19 #include /**/ "ace/pre.h"
21 #include "ace/config-lite.h"
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # pragma once
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #include "ace/os_include/sys/os_types.h"
28 #include "ace/os_include/os_pthread.h"
30 #if !defined (ACE_LACKS_SIGNAL_H)
31 extern "C" {
32 # include /**/ <signal.h>
34 #endif /* !ACE_LACKS_SIGNAL_H */
36 // This must come after signal.h is #included.
37 #if defined (SCO)
38 # define SIGIO SIGPOLL
39 # include /**/ <sys/regset.h>
40 #endif /* SCO */
42 #if defined (ACE_HAS_SIGINFO_T)
43 # if !defined (ACE_LACKS_SIGINFO_H)
44 # if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX)
45 # include /**/ <sys/siginfo.h>
46 # else /* __QNX__ || __OpenBSD__ */
47 # include /**/ <siginfo.h>
48 # endif /* __QNX__ || __OpenBSD__ */
49 # endif /* ACE_LACKS_SIGINFO_H */
50 #endif /* ACE_HAS_SIGINFO_T */
52 #if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__)
53 # include /**/ <sigLib.h>
54 #endif /* ACE_VXWORKS */
56 // Place all additions (especially function declarations) within extern "C" {}
57 #ifdef __cplusplus
58 extern "C"
60 #endif /* __cplusplus */
62 #if defined (ACE_LACKS_SIGSET)
63 typedef u_int sigset_t;
64 #endif /* ACE_LACKS_SIGSET */
66 #if defined (ACE_HAS_SIG_MACROS)
67 # undef sigemptyset
68 # undef sigfillset
69 # undef sigaddset
70 # undef sigdelset
71 # undef sigismember
72 #endif /* ACE_HAS_SIG_MACROS */
74 // This must come after signal.h is #included. It's to counteract
75 // the sigemptyset and sigfillset #defines, which only happen
76 // when __OPTIMIZE__ is #defined (really!) on Linux.
77 #if defined (linux) && defined (__OPTIMIZE__)
78 # undef sigemptyset
79 # undef sigfillset
80 #endif /* linux && __OPTIMIZE__ */
82 #if !defined (ACE_HAS_SIG_ATOMIC_T)
83 typedef int sig_atomic_t;
84 #endif /* !ACE_HAS_SIG_ATOMIC_T */
86 # if !defined (SA_SIGINFO)
87 # define SA_SIGINFO 0
88 # endif /* SA_SIGINFO */
90 # if !defined (SA_RESTART)
91 # define SA_RESTART 0
92 # endif /* SA_RESTART */
94 #if !defined (SIGHUP)
95 # define SIGHUP 0
96 #endif /* SIGHUP */
98 #if !defined (SIGINT)
99 # define SIGINT 0
100 #endif /* SIGINT */
102 #if !defined (SIGSEGV)
103 # define SIGSEGV 0
104 #endif /* SIGSEGV */
106 #if !defined (SIGIO)
107 # define SIGIO 0
108 #endif /* SIGSEGV */
110 #if !defined (SIGUSR1)
111 # define SIGUSR1 0
112 #endif /* SIGUSR1 */
114 #if !defined (SIGUSR2)
115 # define SIGUSR2 0
116 #endif /* SIGUSR2 */
118 #if !defined (SIGCHLD)
119 # define SIGCHLD 0
120 #endif /* SIGCHLD */
122 #if !defined (SIGCLD)
123 # define SIGCLD SIGCHLD
124 #endif /* SIGCLD */
126 #if !defined (SIGQUIT)
127 # define SIGQUIT 0
128 #endif /* SIGQUIT */
130 #if !defined (SIGPIPE)
131 # define SIGPIPE 0
132 #endif /* SIGPIPE */
134 #if !defined (SIGALRM)
135 # define SIGALRM 0
136 #endif /* SIGALRM */
138 #if !defined (SIG_DFL)
139 # define SIG_DFL ((__sighandler_t) 0)
140 #endif /* SIG_DFL */
142 #if !defined (SIG_IGN)
143 # define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
144 #endif /* SIG_IGN */
146 #if !defined (SIG_ERR)
147 # define SIG_ERR ((__sighandler_t) -1) /* error return from signal */
148 #endif /* SIG_ERR */
150 // These are used by the <ACE_IPC_SAP::enable> and
151 // <ACE_IPC_SAP::disable> methods. They must be unique and cannot
152 // conflict with the value of <ACE_NONBLOCK>. We make the numbers
153 // negative here so they won't conflict with other values like SIGIO,
154 // etc.
155 # define ACE_SIGIO -1
156 # define ACE_SIGURG -2
157 # define ACE_CLOEXEC -3
159 #if defined (ACE_VXWORKS)
160 # define ACE_NSIG (_NSIGS + 1)
161 #elif defined (__Lynx__) || defined (ACE_HAS_RTEMS)
162 # define ACE_NSIG (NSIG + 1)
163 #else
164 // All other platforms set NSIG to one greater than the
165 // highest-numbered signal.
166 # define ACE_NSIG NSIG
167 #endif /* __Lynx__ */
169 #if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
170 // Prototypes for both signal() and struct sigaction are consistent..
171 typedef void (*ACE_SignalHandler)(int);
172 typedef void (*ACE_SignalHandlerV)(int);
173 #elif defined (ACE_HAS_LYNXOS_SIGNALS) || defined (ACE_HAS_TANDEM_SIGNALS)
174 typedef void (*ACE_SignalHandler)(...);
175 typedef void (*ACE_SignalHandlerV)(...);
176 #elif defined (ACE_HAS_SVR4_SIGNAL_T)
177 // SVR4 Signals are inconsistent (e.g., see struct sigaction)..
178 typedef void (*ACE_SignalHandler)(int);
179 typedef void (*ACE_SignalHandlerV)(void);
180 #elif defined (ACE_WIN32)
181 typedef void (__cdecl *ACE_SignalHandler)(int);
182 typedef void (__cdecl *ACE_SignalHandlerV)(int);
183 #elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T)
184 typedef void (*ACE_SignalHandler)(int);
185 typedef void (*ACE_SignalHandlerV)(...);
186 #elif defined (INTEGRITY)
187 typedef void (*ACE_SignalHandler)();
188 typedef void (*ACE_SignalHandlerV)(int);
189 #elif defined (ACE_HAS_RTEMS)
190 typedef void (*ACE_SignalHandler)();
191 typedef void (*ACE_SignalHandlerV)();
192 #else /* This is necessary for some older broken version of cfront */
193 # if defined (SIG_PF)
194 # define ACE_SignalHandler SIG_PF
195 # else
196 typedef void (*ACE_SignalHandler)(int);
197 # endif /* SIG_PF */
198 typedef void (*ACE_SignalHandlerV)(...);
199 #endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
201 #if defined (ACE_LACKS_SIGACTION)
202 struct sigaction
204 int sa_flags;
205 ACE_SignalHandlerV sa_handler;
206 sigset_t sa_mask;
208 #endif /* ACE_LACKS_SIGACTION */
210 // Defining POSIX4 real-time signal range.
211 #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
212 # define ACE_SIGRTMIN SIGRTMIN
213 # define ACE_SIGRTMAX SIGRTMAX
214 #else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */
215 # ifndef ACE_SIGRTMIN
216 # define ACE_SIGRTMIN 0
217 # endif /* ACE_SIGRTMIN */
218 # ifndef ACE_SIGRTMAX
219 # define ACE_SIGRTMAX 0
220 # endif /* ACE_SIGRTMAX */
221 #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
223 #if defined (DIGITAL_UNIX)
224 // sigwait is yet another macro on Digital UNIX 4.0, just causing
225 // trouble when introducing member functions with the same name.
226 // Thanks to Thilo Kielmann" <kielmann@informatik.uni-siegen.de> for
227 // this fix.
228 # if defined (__DECCXX_VER)
229 # undef sigwait
230 // cxx on Digital Unix 4.0 needs this declaration. With it,
231 // <::_Psigwait> works with cxx -pthread. g++ does _not_ need
232 // it.
233 int _Psigwait __((const sigset_t *set, int *sig));
234 # endif /* __DECCXX_VER */
235 #elif !defined (ACE_HAS_SIGWAIT)
236 # if defined(ACE_HAS_RTEMS)
237 int sigwait (const sigset_t *set, int *sig);
238 # else
239 int sigwait (sigset_t *set);
240 # endif /* ACE_HAS_RTEMS */
241 #endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */
243 #if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE)
244 int pthread_sigmask(int, const sigset_t *, sigset_t *);
245 #endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE */
247 #ifdef __cplusplus
249 #endif /* __cplusplus */
251 #include "ace/os_include/os_ucontext.h"
253 #include /**/ "ace/post.h"
254 #endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */