/usr/include/ace/Signal.h is in libace-dev 6.0.3+dfsg-0.1.
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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | // -*- C++ -*-
//=============================================================================
/**
* @file Signal.h
*
* $Id: Signal.h 80826 2008-03-04 14:51:23Z wotte $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_SIGNAL_H
#define ACE_SIGNAL_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if defined (ACE_DONT_INCLUDE_ACE_SIGNAL_H)
# error ace/Signal.h was #included instead of signal.h by ace/OS_NS_signal.h: fix!!!!
#endif /* ACE_DONT_INCLUDE_ACE_SIGNAL_H */
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/OS_NS_signal.h"
// Type of the extended signal handler.
typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext);
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Sig_Set
*
* @brief Provide a C++ wrapper for the C sigset_t interface.
*
* Handle signals via a more elegant C++ interface (e.g.,
* doesn't require the use of global variables or global
* functions in an application).
*/
class ACE_Export ACE_Sig_Set
{
public:
// = Initialization and termination methods.
/// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (sigset_t *sigset);
/// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill
/// the set.
ACE_Sig_Set (ACE_Sig_Set *sigset);
/// If @a fill == 0 then initialize the <sigset_> to be empty, else
/// full.
ACE_Sig_Set (int fill = 0);
~ACE_Sig_Set (void);
/// Create a set that excludes all signals defined by the system.
int empty_set (void);
/// Create a set that includes all signals defined by the system.
int fill_set (void);
/// Adds the individual signal specified by @a signo to the set.
int sig_add (int signo);
/// Deletes the individual signal specified by @a signo from the set.
int sig_del (int signo);
/// Checks whether the signal specified by @a signo is in the set.
int is_member (int signo) const;
/// Returns a pointer to the underlying @c sigset_t.
operator sigset_t *();
/// Returns a copy of the underlying @c sigset_t.
sigset_t sigset (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Set of signals.
sigset_t sigset_;
};
/**
* @class ACE_Sig_Action
*
* @brief C++ wrapper facade for the @c sigaction struct.
*/
class ACE_Export ACE_Sig_Action
{
public:
// = Initialization methods.
/// Default constructor. Initializes everything to 0.
ACE_Sig_Action (void);
/// Assigns the various fields of a @c sigaction struct but doesn't
/// register for signal handling via the @c sigaction function.
ACE_Sig_Action (ACE_SignalHandler handler,
sigset_t *sigmask = 0,
int flags = 0);
/// Assigns the various fields of a @c sigaction struct but doesn't
/// register for signal handling via the @c sigaction function.
ACE_Sig_Action (ACE_SignalHandler handler,
const ACE_Sig_Set &sigmask,
int flags = 0);
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process signal @a signum via the @c sigaction
* function.
*/
ACE_Sig_Action (ACE_SignalHandler handler,
int signum,
sigset_t *sigmask = 0,
int flags = 0);
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process signal @a signum via the @c sigaction
* function.
*/
ACE_Sig_Action (ACE_SignalHandler handler,
int signum,
const ACE_Sig_Set &sigmask,
int flags = 0);
// @@ The next two methods have a parameter as "signalss". Please do
// not change the argument name as "signals". This causes the
// following problem as reported by
// <James.Briggs@dsto.defence.gov.au>.
// In the file Signal.h two of the functions have and argument name
// of signals. signals is a Qt macro (to do with their meta object
// stuff.
// We could as well have it as "signal", but I am nost sure whether
// that would cause a problem with something else - Bala <bala@cs>
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process all @a signalss via the @c sigaction
* function.
*/
ACE_Sig_Action (const ACE_Sig_Set &signalss,
ACE_SignalHandler handler,
const ACE_Sig_Set &sigmask,
int flags = 0);
/**
* Assigns the various fields of a @c sigaction struct and registers
* the @a handler to process all @a signalss via the @c sigaction
* function.
*/
ACE_Sig_Action (const ACE_Sig_Set &signalss,
ACE_SignalHandler handler,
sigset_t *sigmask = 0,
int flags = 0);
/// Copy constructor.
ACE_Sig_Action (const ACE_Sig_Action &s);
/// Default dtor.
~ACE_Sig_Action (void);
// = Signal action management.
/// Register @c this as the current disposition and store old
/// disposition into @a oaction if it is non-NULL.
int register_action (int signum,
ACE_Sig_Action *oaction = 0);
/// Assign the value of @a oaction to @c this and make it become the
/// new signal disposition.
int restore_action (int signum,
ACE_Sig_Action &oaction);
/// Retrieve the current disposition into @c this.
int retrieve_action (int signum);
/// Set current signal action.
void set (struct sigaction *);
/// Get current signal action.
struct sigaction *get (void);
operator struct sigaction *();
/// Set current signal flags.
void flags (int);
/// Get current signal flags.
int flags (void);
/// Set current signal mask.
void mask (sigset_t *);
void mask (ACE_Sig_Set &);
/// Get current signal mask.
sigset_t *mask (void);
/// Set current signal handler (pointer to function).
void handler (ACE_SignalHandler);
/// Get current signal handler (pointer to function).
ACE_SignalHandler handler (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Controls signal behavior.
struct sigaction sa_;
};
/**
* @class ACE_Sig_Guard
*
* @brief Hold signals in MASK for duration of a C++ statement block.
* Note that a "0" for mask causes all signals to be held.
*/
class ACE_Export ACE_Sig_Guard
{
public:
// = Initialization and termination methods.
/// This is kind of conditional Guard, needed when guard should be
/// activated only when a spcific condition met. When condition ==
/// true (default), Guard is activated
ACE_Sig_Guard (ACE_Sig_Set *mask = 0, bool condition = true);
/// Restore blocked signals.
~ACE_Sig_Guard (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Original signal mask.
ACE_Sig_Set omask_;
/// Guard Condition
bool condition_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Signal.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_SIGNAL_HANDLER_H */
|