/usr/include/ace/OS_NS_signal.inl is in libace-dev 6.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | // -*- C++ -*-
//
// $Id: OS_NS_signal.inl 87480 2009-11-11 11:38:15Z olli $
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_errno.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE_OS
{
ACE_INLINE int
kill (pid_t pid, int signum)
{
ACE_OS_TRACE ("ACE_OS::kill");
#if defined (ACE_LACKS_KILL)
ACE_UNUSED_ARG (pid);
ACE_UNUSED_ARG (signum);
ACE_NOTSUP_RETURN (-1);
#else
ACE_OSCALL_RETURN (::kill (pid, signum), int, -1);
#endif /* ACE_LACKS_KILL */
}
ACE_INLINE int
pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp)
{
#if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_SIGMASK)
int result;
ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_sigmask (how, nsp, osp),
result),
int,
-1);
#else /* !ACE_HAS_PTHREADS && !ACE_LACKS_PTHREAD_SIGMASK */
ACE_UNUSED_ARG (how);
ACE_UNUSED_ARG (nsp);
ACE_UNUSED_ARG (osp);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_PTHREADS && !ACE_LACKS_PTHREAD_SIGMASK */
}
ACE_INLINE int
sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa)
{
ACE_OS_TRACE ("ACE_OS::sigaction");
if (signum == 0)
return 0;
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
struct sigaction sa;
if (osa == 0)
osa = &sa;
if (nsa == 0)
{
osa->sa_handler = ::signal (signum, SIG_IGN);
::signal (signum, osa->sa_handler);
}
else
osa->sa_handler = ::signal (signum, nsa->sa_handler);
return osa->sa_handler == SIG_ERR ? -1 : 0;
#elif defined (ACE_LACKS_SIGACTION)
ACE_UNUSED_ARG (nsa);
ACE_UNUSED_ARG (osa);
ACE_NOTSUP_RETURN (-1);
#elif !defined (ACE_HAS_SIGACTION_CONSTP2)
ACE_OSCALL_RETURN (::sigaction (signum,
const_cast<ACE_SIGACTION*> (nsa),
osa),
int, -1);
#else
ACE_OSCALL_RETURN (::sigaction (signum, nsa, osa), int, -1);
#endif /* ACE_WIN32 !ACE_HAS_WINCE */
}
ACE_INLINE int
sigaddset (sigset_t *s, int signum)
{
ACE_OS_TRACE ("ACE_OS::sigaddset");
#if defined (ACE_LACKS_SIGSET)
if (s == 0)
{
errno = EFAULT;
return -1;
}
else if (signum < 1 || signum >= ACE_NSIG)
{
errno = EINVAL;
return -1; // Invalid signum, return error
}
*s |= (1 << (signum - 1)) ;
return 0 ;
#else
return ace_sigaddset_helper (s, signum);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE int
sigdelset (sigset_t *s, int signum)
{
#if defined (ACE_LACKS_SIGSET)
if (s == 0)
{
errno = EFAULT;
return -1;
}
else if (signum < 1 || signum >= ACE_NSIG)
{
errno = EINVAL;
return -1; // Invalid signum, return error
}
*s &= ~(1 << (signum - 1)) ;
return 0;
#else
return ace_sigdelset_helper (s, signum);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE int
sigemptyset (sigset_t *s)
{
#if defined (ACE_LACKS_SIGSET)
if (s == 0)
{
errno = EFAULT;
return -1;
}
*s = 0 ;
return 0;
#else
return ace_sigemptyset_helper (s);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE int
sigfillset (sigset_t *s)
{
#if defined (ACE_LACKS_SIGSET)
if (s == 0)
{
errno = EFAULT;
return -1;
}
*s = ~(sigset_t) 0;
return 0 ;
#else
return ace_sigfillset_helper (s);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE int
sigismember (sigset_t *s, int signum)
{
#if defined (ACE_LACKS_SIGSET)
if (s == 0)
{
errno = EFAULT;
return -1;
}
else if (signum < 1 || signum >= ACE_NSIG)
{
errno = EINVAL;
return -1; // Invalid signum, return error
}
return ((*s & (1 << (signum - 1))) != 0) ;
#else
# if defined (ACE_HAS_SIGISMEMBER_BUG)
if (signum < 1 || signum >= ACE_NSIG)
{
errno = EINVAL;
return -1; // Invalid signum, return error
}
# endif /* ACE_HAS_SIGISMEMBER_BUG */
return ace_sigismember_helper (s, signum);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE ACE_SignalHandler
signal (int signum, ACE_SignalHandler func)
{
if (signum == 0)
return 0;
else
# if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) || !defined (ACE_LACKS_UNIX_SIGNALS)
# if !defined (ACE_HAS_TANDEM_SIGNALS) && !defined (ACE_HAS_LYNXOS4_SIGNALS)
return ::signal (signum, func);
# else
return (ACE_SignalHandler) ::signal (signum, (void (*)(int)) func);
# endif /* !ACE_HAS_TANDEM_SIGNALS && !ACE_HAS_LYNXOS4_SIGNALS */
#else
// @@ WINCE: Don't know how to implement signal on WinCE (yet.)
ACE_UNUSED_ARG (signum);
ACE_UNUSED_ARG (func);
ACE_NOTSUP_RETURN (0); // Should return SIG_ERR but it is not defined on WinCE.
#endif /* defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) || !defined (ACE_LACKS_UNIX_SIGNALS) */
}
ACE_INLINE int
sigprocmask (int how, const sigset_t *nsp, sigset_t *osp)
{
#if defined (ACE_LACKS_SIGSET)
ACE_UNUSED_ARG (how);
ACE_UNUSED_ARG (nsp);
ACE_UNUSED_ARG (osp);
ACE_NOTSUP_RETURN (-1);
#else
ACE_OSCALL_RETURN (::sigprocmask (how, nsp, osp), int, -1);
#endif /* ACE_LACKS_SIGSET */
}
ACE_INLINE int
sigsuspend (const sigset_t *s)
{
#if defined (ACE_HAS_SIGSUSPEND)
sigset_t sigset;
if (s == 0)
{
ACE_OS::sigemptyset (&sigset);
s = &sigset;
}
return ace_sigsuspend_helper (s);
#else
ACE_UNUSED_ARG (s);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SIGSUSPEND */
}
ACE_INLINE int
raise (const int signum)
{
#if defined (ACE_LACKS_RAISE)
ACE_UNUSED_ARG (signum);
ACE_NOTSUP_RETURN (-1);
#else
ACE_OSCALL_RETURN (::raise (signum), int, -1);
#endif /* ACE_LACKS_RAISE */
}
} /* end namespace ACE_OS */
ACE_END_VERSIONED_NAMESPACE_DECL
|