3 //=============================================================================
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)
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)
32 # include /**/ <signal.h>
34 #endif /* !ACE_LACKS_SIGNAL_H */
36 // This must come after signal.h is #included.
38 # define SIGIO SIGPOLL
39 # include /**/ <sys/regset.h>
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" {}
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)
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__)
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)
88 # endif /* SA_SIGINFO */
90 # if !defined (SA_RESTART)
92 # endif /* SA_RESTART */
102 #if !defined (SIGSEGV)
110 #if !defined (SIGUSR1)
114 #if !defined (SIGUSR2)
118 #if !defined (SIGCHLD)
122 #if !defined (SIGCLD)
123 # define SIGCLD SIGCHLD
126 #if !defined (SIGQUIT)
130 #if !defined (SIGPIPE)
134 #if !defined (SIGALRM)
138 #if !defined (SIG_DFL)
139 # define SIG_DFL ((__sighandler_t) 0)
142 #if !defined (SIG_IGN)
143 # define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
146 #if !defined (SIG_ERR)
147 # define SIG_ERR ((__sighandler_t) -1) /* error return from signal */
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,
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)
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
196 typedef void (*ACE_SignalHandler
)(int);
198 typedef void (*ACE_SignalHandlerV
)(...);
199 #endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
201 #if defined (ACE_LACKS_SIGACTION)
205 ACE_SignalHandlerV sa_handler
;
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
228 # if defined (__DECCXX_VER)
230 // cxx on Digital Unix 4.0 needs this declaration. With it,
231 // <::_Psigwait> works with cxx -pthread. g++ does _not_ need
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
);
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 */
249 #endif /* __cplusplus */
251 #include "ace/os_include/os_ucontext.h"
253 #include /**/ "ace/post.h"
254 #endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */