libassa 3.5.0
|
#include <SigAction.h>
Public Member Functions | |
SigAction () | |
Default constructor creates SigAction object with null-action. | |
SigAction (C_SIG_HANDLER handler_, SigSet *sig_mask_=0, int flags_=0) | |
Construct a SigAction object with "C" signal handler function. | |
SigAction (C_SIG_HANDLER handler_, int signum_, SigSet *sig_mask_=0, int flags_=0) | |
Construct a SigAction with "C" signal handler function and change program's disposition for signum_ immediately. | |
int | register_action (int signum_, SigAction *oaction_=0) |
Register this object as current disposition for signal signum_, and store old disposition in oaction_, if not NULL. | |
int | restore_action (int signum_, SigAction &oaction_) |
Change object's disposition to oaction_, and install it as current disposition for the signal signum_. | |
int | retrieve_action (int signum_) |
Retrieve current disposition for the signal signum_ into this object. | |
void | action (SIGACTION *sa_) |
Set sigaction structure to sa_. | |
SIGACTION * | action () |
Retrieve current sigaction. | |
void | flags (int new_flags_) |
Set signal flags to new_flags_. | |
int | flags () |
Retrieve current flags. | |
void | mask (SigSet &mask_set_) |
Set new signal mask mask_set_. | |
SigSet | mask () |
Retrieve current signal mask. | |
void | handler (C_SIG_HANDLER sha_) |
Set new signal handler to function pointer sha_. | |
C_SIG_HANDLER | handler () |
Retrieve current signal handler function. | |
operator SIGACTION * () | |
Conversion operator that converts SigAction to a pointer to the internal struct sigaction data member for direct use with C-library functions. | |
Private Attributes | |
SIGACTION | m_sa |
sigaction structure itself |
Definition at line 94 of file SigAction.h.
ASSA::SigAction::SigAction | ( | ) | [inline] |
Default constructor creates SigAction object with null-action.
Definition at line 221 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::SigAction", SIGACT); m_sa.sa_flags = 0; sigemptyset(&m_sa.sa_mask); *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) 0; }
ASSA::SigAction::SigAction | ( | C_SIG_HANDLER | handler_, |
SigSet * | sig_mask_ = 0 , |
||
int | flags_ = 0 |
||
) | [inline] |
Construct a SigAction object with "C" signal handler function.
This constructor doesn't install any actions - it is merely a shell for actiono to be installed for any signal(s). Thus, you can reuse the same object for number of differen signals.
handler_ | "C" signal handler function to call. |
sig_mask_ | Set of signals to block while handler_ is active. |
flags_ | Controls behavior of signal handler (OS-specific: see Available Options: section of documentation). |
Definition at line 232 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::SigAction(,,)", SIGACT); m_sa.sa_flags = flags_; if (sig_mask_ == NULL) { sigemptyset(&m_sa.sa_mask); } else { /*--- here, suppose to do bitwise structure assignment, but does it really do so? = *sig_mask_ = *(sig_mask_.operator *()) = *(SigSet *tmp = &sig_mask_.m_sa) ???? ---*/ m_sa.sa_mask = **sig_mask_; } *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) handler_; }
ASSA::SigAction::SigAction | ( | C_SIG_HANDLER | handler_, |
int | signum_, | ||
SigSet * | sig_mask_ = 0 , |
||
int | flags_ = 0 |
||
) | [inline] |
Construct a SigAction with "C" signal handler function and change program's disposition for signum_ immediately.
First argument is the "C" function. It cannot be a non-static C++ class member function. This function pretty much simulates C-like approach the the signal handling. For C++ member function approach, see SigHandler & Co.
handler_ | "C" signal handler function to call. |
signum_ | Signal which disposition is to change. |
sig_mask_ | Set of signals to block while handler_ is active. |
flags_ | Controls behavior of signal handler (OS-specific: see Available Options: section of documentation). |
Definition at line 257 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::SigAction(,,,)", SIGACT); m_sa.sa_flags = flags_; if (sig_mask_ == NULL) { sigemptyset(&m_sa.sa_mask); } else { /*--- same problem as above... ---*/ m_sa.sa_mask = **sig_mask_; } *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) handler_; /*--- installing disposition... ---*/ sigaction (signum_, &m_sa, 0); }
void ASSA::SigAction::action | ( | SIGACTION * | sa_ | ) | [inline] |
Set sigaction structure to sa_.
sa_ | New value for internal struct sigaction. |
Definition at line 280 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
Referenced by register_action(), and restore_action().
{ trace_with_mask("SigAction::action", SIGACT); m_sa = *sa_; }
SIGACTION * ASSA::SigAction::action | ( | ) | [inline] |
Retrieve current sigaction.
Definition at line 288 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::action", SIGACT); return &m_sa; }
void ASSA::SigAction::flags | ( | int | new_flags_ | ) | [inline] |
Set signal flags to new_flags_.
new_flags_ | New flags for this action. |
Definition at line 297 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("void SigAction::flags()", SIGACT); m_sa.sa_flags = new_flags_; }
int ASSA::SigAction::flags | ( | ) | [inline] |
Retrieve current flags.
Definition at line 306 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("int SigAction::flags()", SIGACT); return m_sa.sa_flags; }
void ASSA::SigAction::handler | ( | C_SIG_HANDLER | sha_ | ) | [inline] |
Set new signal handler to function pointer sha_.
Definition at line 334 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
Referenced by ASSA::SigHandlers::install(), ASSA::SigHandler::install(), and ASSA::SigHandlers::remove().
{ trace_with_mask("void SigAction::handler()", SIGACT); *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) sha_; }
C_SIG_HANDLER ASSA::SigAction::handler | ( | ) | [inline] |
Retrieve current signal handler function.
Definition at line 343 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("C_SIG_HANDLER SigAction::handler()", SIGACT); return (C_SIG_HANDLER) m_sa.sa_handler; }
void ASSA::SigAction::mask | ( | SigSet & | mask_set_ | ) | [inline] |
Set new signal mask mask_set_.
Definition at line 315 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("void SigAction::mask()", SIGACT); m_sa.sa_mask = *mask_set_; }
SigSet ASSA::SigAction::mask | ( | ) | [inline] |
Retrieve current signal mask.
Definition at line 324 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigSet SigAction::mask()", SIGACT); SigSet tmpset(&m_sa.sa_mask); return tmpset; }
ASSA::SigAction::operator SIGACTION * | ( | ) | [inline] |
Conversion operator that converts SigAction to a pointer to the internal struct sigaction data member for direct use with C-library functions.
Definition at line 351 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::operator SIGACTION * ()", SIGACT); return &m_sa; }
int ASSA::SigAction::register_action | ( | int | signum_, |
SigAction * | oaction_ = 0 |
||
) | [inline] |
Register this object as current disposition for signal signum_, and store old disposition in oaction_, if not NULL.
This function installs C_SIG_HANDLER this object represents, thus simulating C-like approach to signal handling.
signum_ | Signal which disposition to install. |
oaction_ | Placeholder for the old disposition. |
Definition at line 360 of file SigAction.h.
References action(), m_sa, ASSA::SIGACT, and trace_with_mask.
Referenced by ASSA::SigHandler::dispatch(), ASSA::GenServer::init(), ASSA::SigHandlers::install(), ASSA::SigHandler::install(), ASSA::SigHandlers::remove(), and ASSA::SigHandler::remove().
{ trace_with_mask("SigAction::register_action()", SIGACT); /*--- place here recursive mutex lock to guard ... ---*/ struct sigaction *osa = oaction_ == 0 ? 0 : oaction_->action(); return sigaction(signum_, &m_sa, osa); }
int ASSA::SigAction::restore_action | ( | int | signum_, |
SigAction & | oaction_ | ||
) | [inline] |
Change object's disposition to oaction_, and install it as current disposition for the signal signum_.
signum_ | Signal which disposition to restore. |
oaction_ | Disposition to restore. |
Definition at line 371 of file SigAction.h.
References action(), m_sa, ASSA::SIGACT, and trace_with_mask.
{ trace_with_mask("SigAction::restore_action()", SIGACT); m_sa = *oaction_.action(); return sigaction(signum_, &m_sa, 0); }
int ASSA::SigAction::retrieve_action | ( | int | signum_ | ) | [inline] |
Retrieve current disposition for the signal signum_ into this object.
signum_ | Signal number |
Definition at line 381 of file SigAction.h.
References m_sa, ASSA::SIGACT, and trace_with_mask.
Referenced by ASSA::SigHandlers::install(), and ASSA::SigHandler::install().
{ trace_with_mask("SigAction::retrieve_action()", SIGACT); return sigaction(signum_, 0, &m_sa); }
SIGACTION ASSA::SigAction::m_sa [private] |
sigaction structure itself
Definition at line 213 of file SigAction.h.
Referenced by action(), flags(), handler(), mask(), operator SIGACTION *(), register_action(), restore_action(), retrieve_action(), and SigAction().