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...
11 //=============================================================================
13 #ifndef ACE_OS_NS_SIGNAL_H
14 # define ACE_OS_NS_SIGNAL_H
16 # include /**/ "ace/pre.h"
18 # include "ace/config-lite.h"
20 # if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/os_include/os_signal.h"
25 #include /**/ "ace/ACE_export.h"
27 #if defined (ACE_EXPORT_MACRO)
28 # undef ACE_EXPORT_MACRO
30 #define ACE_EXPORT_MACRO ACE_Export
32 #if defined (__Lynx__) || defined (__OpenBSD__)
33 // LynxOS and OpenBSD define pthread_sigmask() in pthread.h
34 # include "ace/os_include/os_pthread.h"
35 #endif /* __Lynx__ || OpenBSD */
38 * We inline and undef some functions that may be implemented
39 * as macros on some platforms. This way macro definitions will
40 * be usable later as there is no way to save the macro definition
41 * using the pre-processor.
44 #if !defined (ACE_LACKS_SIGSET)
45 inline int ace_sigemptyset_helper (sigset_t
*s
)
47 # if defined (sigemptyset)
48 return sigemptyset (s
);
51 return ::sigemptyset (s
);
52 # endif /* defined (sigemptyset) */
55 inline int ace_sigfillset_helper (sigset_t
*s
)
57 # if defined (sigfillset)
58 return sigfillset (s
);
61 return ::sigfillset (s
);
62 # endif /* defined (sigfillset) */
65 inline int ace_sigaddset_helper (sigset_t
*s
, int signum
)
67 # if defined (sigaddset)
68 return sigaddset (s
, signum
);
71 return ::sigaddset (s
, signum
);
72 # endif /* defined (sigaddset) */
75 inline int ace_sigdelset_helper (sigset_t
*s
, int signum
)
77 # if defined (sigdelset)
78 return sigdelset (s
, signum
);
81 return ::sigdelset (s
, signum
);
82 # endif /* defined (sigdelset) */
85 inline int ace_sigismember_helper (sigset_t
*s
, int signum
)
87 # if defined (sigismember)
88 return sigismember (s
, signum
);
91 return ::sigismember (s
, signum
);
92 # endif /* defined (sigismember) */
94 #endif /* !defined (ACE_LACKS_SIGSET) */
96 #if defined (ACE_HAS_SIGSUSPEND)
97 inline int ace_sigsuspend_helper (const sigset_t
*s
)
99 # if defined (sigsuspend)
100 return sigsuspend (s
);
103 return ::sigsuspend (s
);
104 # endif /* defined (sigsuspen) */
106 #endif /* ACE_HAS_SIGSUSPEND */
108 # if !defined (SIG_BLOCK)
110 # endif /* SIG_BLOCK */
112 # if !defined (SIG_UNBLOCK)
113 # define SIG_UNBLOCK 2
114 # endif /* SIG_UNBLOCK */
116 # if !defined (SIG_SETMASK)
117 # define SIG_SETMASK 3
118 # endif /* SIG_SETMASK */
120 // Create some useful typedefs.
122 # if !defined (ACE_HAS_SIGINFO_T)
123 struct ACE_Export siginfo_t
125 siginfo_t (ACE_HANDLE handle
);
127 /// Win32 HANDLE that has become signaled.
128 ACE_HANDLE si_handle_
;
130 # endif /* ACE_HAS_SIGINFO_T */
132 #if !defined (ACE_WIN32)
135 typedef void (*ACE_SIGNAL_C_FUNC
)(int, siginfo_t
*, void *);
137 #endif /* ACE_WIN32 */
139 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
141 typedef struct sigaction ACE_SIGACTION
;
144 //@{ @name A set of wrappers for Signals.
146 ACE_NAMESPACE_INLINE_FUNCTION
150 #ifdef pthread_sigmask
151 # define ACE_PTHREAD_SIGMASK_MACRO pthread_sigmask
152 # undef pthread_sigmask
154 ACE_NAMESPACE_INLINE_FUNCTION
155 int pthread_sigmask (int how
,
159 ACE_NAMESPACE_INLINE_FUNCTION
160 int sigaction (int signum
,
161 const ACE_SIGACTION
*nsa
,
164 ACE_NAMESPACE_INLINE_FUNCTION
165 int sigaddset (sigset_t
*s
,
168 ACE_NAMESPACE_INLINE_FUNCTION
169 int sigdelset (sigset_t
*s
,
172 ACE_NAMESPACE_INLINE_FUNCTION
173 int sigemptyset (sigset_t
*s
);
175 ACE_NAMESPACE_INLINE_FUNCTION
176 int sigfillset (sigset_t
*s
);
178 ACE_NAMESPACE_INLINE_FUNCTION
179 int sigismember (sigset_t
*s
,
182 ACE_NAMESPACE_INLINE_FUNCTION
183 ACE_SignalHandler
signal (int signum
,
186 ACE_NAMESPACE_INLINE_FUNCTION
187 int sigprocmask (int how
,
191 ACE_NAMESPACE_INLINE_FUNCTION
192 int sigsuspend (const sigset_t
*s
);
194 ACE_NAMESPACE_INLINE_FUNCTION
195 int raise (const int signum
);
198 } /* namespace ACE_OS */
200 ACE_END_VERSIONED_NAMESPACE_DECL
202 # if defined (ACE_HAS_INLINED_OSCALLS)
203 # if defined (ACE_INLINE)
205 # endif /* ACE_INLINE */
206 # define ACE_INLINE inline
207 # include "ace/OS_NS_signal.inl"
208 # endif /* ACE_HAS_INLINED_OSCALLS */
210 # include /**/ "ace/post.h"
211 #endif /* ACE_OS_NS_SIGNAL_H */