3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
13 //=============================================================================
15 #ifndef ACE_OS_NS_SIGNAL_H
16 # define ACE_OS_NS_SIGNAL_H
18 # include /**/ "ace/pre.h"
20 # include "ace/config-lite.h"
22 # if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "ace/os_include/os_signal.h"
27 #include /**/ "ace/ACE_export.h"
29 #if defined (ACE_EXPORT_MACRO)
30 # undef ACE_EXPORT_MACRO
32 #define ACE_EXPORT_MACRO ACE_Export
34 #if defined (__Lynx__) || defined (__OpenBSD__)
35 // LynxOS and OpenBSD define pthread_sigmask() in pthread.h
36 # include "ace/os_include/os_pthread.h"
37 #endif /* __Lynx__ || OpenBSD */
40 * We inline and undef some functions that may be implemented
41 * as macros on some platforms. This way macro definitions will
42 * be usable later as there is no way to save the macro definition
43 * using the pre-processor.
46 #if !defined (ACE_LACKS_SIGSET)
47 inline int ace_sigemptyset_helper (sigset_t
*s
)
49 # if defined (sigemptyset)
50 return sigemptyset (s
);
53 return ACE_STD_NAMESPACE::sigemptyset (s
);
54 # endif /* defined (sigemptyset) */
57 inline int ace_sigfillset_helper (sigset_t
*s
)
59 # if defined (sigfillset)
60 return sigfillset (s
);
63 return ACE_STD_NAMESPACE::sigfillset (s
);
64 # endif /* defined (sigfillset) */
67 inline int ace_sigaddset_helper (sigset_t
*s
, int signum
)
69 # if defined (sigaddset)
70 return sigaddset (s
, signum
);
73 return ACE_STD_NAMESPACE::sigaddset (s
, signum
);
74 # endif /* defined (sigaddset) */
77 inline int ace_sigdelset_helper (sigset_t
*s
, int signum
)
79 # if defined (sigdelset)
80 return sigdelset (s
, signum
);
83 return ACE_STD_NAMESPACE::sigdelset (s
, signum
);
84 # endif /* defined (sigdelset) */
87 inline int ace_sigismember_helper (sigset_t
*s
, int signum
)
89 # if defined (sigismember)
90 return sigismember (s
, signum
);
93 return ACE_STD_NAMESPACE::sigismember (s
, signum
);
94 # endif /* defined (sigismember) */
96 #endif /* !defined (ACE_LACKS_SIGSET) */
98 #if defined (ACE_HAS_SIGSUSPEND)
99 inline int ace_sigsuspend_helper (const sigset_t
*s
)
101 # if defined (sigsuspend)
102 return sigsuspend (s
);
105 return ACE_STD_NAMESPACE::sigsuspend (s
);
106 # endif /* defined (sigsuspen) */
108 #endif /* ACE_HAS_SIGSUSPEND */
111 # if !defined (SIG_BLOCK)
113 # endif /* SIG_BLOCK */
115 # if !defined (SIG_UNBLOCK)
116 # define SIG_UNBLOCK 2
117 # endif /* SIG_UNBLOCK */
119 # if !defined (SIG_SETMASK)
120 # define SIG_SETMASK 3
121 # endif /* SIG_SETMASK */
123 // Create some useful typedefs.
125 # if !defined (ACE_HAS_SIGINFO_T)
126 struct ACE_Export siginfo_t
128 siginfo_t (ACE_HANDLE handle
);
130 /// Win32 HANDLE that has become signaled.
131 ACE_HANDLE si_handle_
;
133 # endif /* ACE_HAS_SIGINFO_T */
135 #if !defined (ACE_WIN32)
138 typedef void (*ACE_SIGNAL_C_FUNC
)(int, siginfo_t
*, void *);
140 #endif /* ACE_WIN32 */
142 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
144 // This hack is needed to get around an odd and hard-to-reproduce problem
145 // with HP aC++. If struct sigaction is defined extern "C" and the sigaction
146 // function in namespace ACE_OS, the compiler sometimes gets confused.
147 // If we help it with this typedef, it's fine. User code should not use
148 // the ACE typedef - it will be removed without warning as soon as we can
149 // either drop support for the broken compilers or figure out how to reproduce
150 // it so it can be reported to HP and fixed.
151 // There's a similar hack in OS_TLI.h for struct t_optmgmt.
152 // Also see ChangeLog entries:
153 // Mon Jan 23 16:35:40 UTC 2006 Steve Huston <shuston@riverace.com>
154 // Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com>
155 #if defined (__HP_aCC) && (__HP_aCC <= 37300)
156 typedef extern "C" struct sigaction ACE_SIGACTION
;
158 typedef struct sigaction ACE_SIGACTION
;
163 //@{ @name A set of wrappers for Signals.
165 ACE_NAMESPACE_INLINE_FUNCTION
169 #ifdef pthread_sigmask
170 # define ACE_PTHREAD_SIGMASK_MACRO pthread_sigmask
171 # undef pthread_sigmask
173 ACE_NAMESPACE_INLINE_FUNCTION
174 int pthread_sigmask (int how
,
178 ACE_NAMESPACE_INLINE_FUNCTION
179 int sigaction (int signum
,
180 const ACE_SIGACTION
*nsa
,
183 ACE_NAMESPACE_INLINE_FUNCTION
184 int sigaddset (sigset_t
*s
,
187 ACE_NAMESPACE_INLINE_FUNCTION
188 int sigdelset (sigset_t
*s
,
191 ACE_NAMESPACE_INLINE_FUNCTION
192 int sigemptyset (sigset_t
*s
);
194 ACE_NAMESPACE_INLINE_FUNCTION
195 int sigfillset (sigset_t
*s
);
197 ACE_NAMESPACE_INLINE_FUNCTION
198 int sigismember (sigset_t
*s
,
201 ACE_NAMESPACE_INLINE_FUNCTION
202 ACE_SignalHandler
signal (int signum
,
205 ACE_NAMESPACE_INLINE_FUNCTION
206 int sigprocmask (int how
,
210 ACE_NAMESPACE_INLINE_FUNCTION
211 int sigsuspend (const sigset_t
*s
);
213 ACE_NAMESPACE_INLINE_FUNCTION
214 int raise (const int signum
);
217 } /* namespace ACE_OS */
219 ACE_END_VERSIONED_NAMESPACE_DECL
221 # if defined (ACE_HAS_INLINED_OSCALLS)
222 # if defined (ACE_INLINE)
224 # endif /* ACE_INLINE */
225 # define ACE_INLINE inline
226 # include "ace/OS_NS_signal.inl"
227 # endif /* ACE_HAS_INLINED_OSCALLS */
229 # include /**/ "ace/post.h"
230 #endif /* ACE_OS_NS_SIGNAL_H */