Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / ace / os_include / os_signal.h
blobef9f3b2cbbf027f656aaf99f4d2b8793b6cc72df
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file os_signal.h
7 * signals
9 * @author Don Hinton <dhinton@dresystems.com>
10 * @author This code was originally in various places including ace/OS.h.
12 //=============================================================================
14 #ifndef ACE_OS_INCLUDE_OS_SIGNAL_H
15 #define ACE_OS_INCLUDE_OS_SIGNAL_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/config-lite.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/os_include/sys/os_types.h"
27 extern "C" {
28 # include /**/ <signal.h>
31 #if defined (ACE_HAS_SIGINFO_T)
32 # if !defined (ACE_LACKS_SIGINFO_H)
33 # if defined (ACE_HAS_SYS_SIGINFO_H)
34 # include /**/ <sys/siginfo.h>
35 # else /* ACE_HAS_SYS_SIGINFO_H */
36 # include /**/ <siginfo.h>
37 # endif /* ACE_HAS_SYS_SIGINFO_H */
38 # endif /* ACE_LACKS_SIGINFO_H */
39 #endif /* ACE_HAS_SIGINFO_T */
41 // Place all additions (especially function declarations) within extern "C" {}
42 #ifdef __cplusplus
43 extern "C"
45 #endif /* __cplusplus */
47 #if defined (ACE_LACKS_SIGSET_T)
48 typedef u_int sigset_t;
49 #endif /* ACE_LACKS_SIGSET_T && !sigset_t */
51 #if !defined (ACE_HAS_SIG_ATOMIC_T)
52 typedef int sig_atomic_t;
53 #endif /* !ACE_HAS_SIG_ATOMIC_T */
55 # if !defined (SA_SIGINFO)
56 # define SA_SIGINFO 0
57 # endif /* SA_SIGINFO */
59 # if !defined (SA_RESTART)
60 # define SA_RESTART 0
61 # endif /* SA_RESTART */
63 #if !defined (SIGHUP)
64 # define SIGHUP 0
65 #endif /* SIGHUP */
67 #if !defined (SIGINT)
68 # define SIGINT 0
69 #endif /* SIGINT */
71 #if !defined (SIGSEGV)
72 # define SIGSEGV 0
73 #endif /* SIGSEGV */
75 #if !defined (SIGIO)
76 # define SIGIO 0
77 #endif /* SIGSEGV */
79 #if !defined (SIGUSR1)
80 # define SIGUSR1 0
81 #endif /* SIGUSR1 */
83 #if !defined (SIGUSR2)
84 # define SIGUSR2 0
85 #endif /* SIGUSR2 */
87 #if !defined (SIGCHLD)
88 # define SIGCHLD 0
89 #endif /* SIGCHLD */
91 #if !defined (SIGCLD)
92 # define SIGCLD SIGCHLD
93 #endif /* SIGCLD */
95 #if !defined (SIGQUIT)
96 # define SIGQUIT 0
97 #endif /* SIGQUIT */
99 #if !defined (SIGPIPE)
100 # define SIGPIPE 0
101 #endif /* SIGPIPE */
103 #if !defined (SIGALRM)
104 # define SIGALRM 0
105 #endif /* SIGALRM */
107 #if !defined (SIGABRT)
108 # define SIGABRT 0
109 #endif /* SIGABRT */
111 #if !defined (SIGTERM)
112 # define SIGTERM 0
113 #endif /* SIGTERM */
115 #if !defined (SIG_DFL)
116 # define SIG_DFL ((__sighandler_t) 0)
117 #endif /* SIG_DFL */
119 #if !defined (SIG_IGN)
120 # define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
121 #endif /* SIG_IGN */
123 #if !defined (SIG_ERR)
124 # define SIG_ERR ((__sighandler_t) -1) /* error return from signal */
125 #endif /* SIG_ERR */
127 // These are used by the <ACE_IPC_SAP::enable> and
128 // <ACE_IPC_SAP::disable> methods. They must be unique and cannot
129 // conflict with the value of <ACE_NONBLOCK>. We make the numbers
130 // negative here so they won't conflict with other values like SIGIO,
131 // etc.
132 # define ACE_SIGIO -1
133 # define ACE_SIGURG -2
134 # define ACE_CLOEXEC -3
136 #if defined (ACE_VXWORKS)
137 # define ACE_NSIG (_NSIGS + 1)
138 #elif defined (__Lynx__)
139 # define ACE_NSIG (NSIG + 1)
140 #else
141 // All other platforms set NSIG to one greater than the
142 // highest-numbered signal.
143 # define ACE_NSIG NSIG
144 #endif /* ACE_VXWORKS */
146 #if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES)
147 // Prototypes for both signal() and struct sigaction are consistent..
148 using ACE_SignalHandler = void (*)(int);
149 using ACE_SignalHandlerV = void (*)(int);
150 #elif defined (ACE_HAS_SVR4_SIGNAL_T)
151 // SVR4 Signals are inconsistent (e.g., see struct sigaction)..
152 using ACE_SignalHandler = void (*)(int);
153 using ACE_SignalHandlerV = void (*)();
154 #elif defined (ACE_WIN32)
155 using ACE_SignalHandler = void (__cdecl *)(int);
156 using ACE_SignalHandlerV = void (__cdecl *)(int);
157 #elif defined (INTEGRITY)
158 using ACE_SignalHandler = void (*)();
159 using ACE_SignalHandlerV = void (*)(int);
160 #else /* This is necessary for some older broken version of cfront */
161 # if defined (SIG_PF)
162 # define ACE_SignalHandler SIG_PF
163 # else
164 using ACE_SignalHandler = void (*)(int);
165 # endif /* SIG_PF */
166 using ACE_SignalHandlerV = void (*)(...);
167 #endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */
169 #if defined (ACE_LACKS_SIGACTION)
170 struct sigaction
172 int sa_flags;
173 ACE_SignalHandlerV sa_handler;
174 sigset_t sa_mask;
176 #endif /* ACE_LACKS_SIGACTION */
178 // Defining POSIX4 real-time signal range.
179 #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
180 # define ACE_SIGRTMIN SIGRTMIN
181 # define ACE_SIGRTMAX SIGRTMAX
182 #else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */
183 # ifndef ACE_SIGRTMIN
184 # define ACE_SIGRTMIN 0
185 # endif /* ACE_SIGRTMIN */
186 # ifndef ACE_SIGRTMAX
187 # define ACE_SIGRTMAX 0
188 # endif /* ACE_SIGRTMAX */
189 #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
191 #ifdef __cplusplus
193 #endif /* __cplusplus */
195 #include "ace/os_include/os_ucontext.h"
197 #include /**/ "ace/post.h"
198 #endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */