Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / OS_NS_signal.h
blob809920dfa3cf7764c53c3f00177f9a035db31058
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_NS_signal.h
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)
21 # 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
29 #endif
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);
49 # undef sigemptyset
50 # else
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);
59 # undef sigfillset
60 # else
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);
69 # undef sigaddset
70 # else
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);
79 # undef sigdelset
80 # else
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);
89 # undef sigismember
90 # else
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);
101 # undef sigsuspend
102 # else
103 return ::sigsuspend (s);
104 # endif /* defined (sigsuspen) */
106 #endif /* ACE_HAS_SIGSUSPEND */
108 # if !defined (SIG_BLOCK)
109 # define SIG_BLOCK 1
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)
133 extern "C"
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;
143 namespace ACE_OS {
144 //@{ @name A set of wrappers for Signals.
146 ACE_NAMESPACE_INLINE_FUNCTION
147 int kill (pid_t pid,
148 int signum);
150 #ifdef pthread_sigmask
151 # define ACE_PTHREAD_SIGMASK_MACRO pthread_sigmask
152 # undef pthread_sigmask
153 #endif
154 ACE_NAMESPACE_INLINE_FUNCTION
155 int pthread_sigmask (int how,
156 const sigset_t *nsp,
157 sigset_t *osp);
159 ACE_NAMESPACE_INLINE_FUNCTION
160 int sigaction (int signum,
161 const ACE_SIGACTION *nsa,
162 ACE_SIGACTION *osa);
164 ACE_NAMESPACE_INLINE_FUNCTION
165 int sigaddset (sigset_t *s,
166 int signum);
168 ACE_NAMESPACE_INLINE_FUNCTION
169 int sigdelset (sigset_t *s,
170 int signum);
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,
180 int signum);
182 ACE_NAMESPACE_INLINE_FUNCTION
183 ACE_SignalHandler signal (int signum,
184 ACE_SignalHandler);
186 ACE_NAMESPACE_INLINE_FUNCTION
187 int sigprocmask (int how,
188 const sigset_t *nsp,
189 sigset_t *osp);
191 ACE_NAMESPACE_INLINE_FUNCTION
192 int sigsuspend (const sigset_t *s);
194 ACE_NAMESPACE_INLINE_FUNCTION
195 int raise (const int signum);
196 //@}
198 } /* namespace ACE_OS */
200 ACE_END_VERSIONED_NAMESPACE_DECL
202 # if defined (ACE_HAS_INLINED_OSCALLS)
203 # if defined (ACE_INLINE)
204 # undef 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 */