#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.
|
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. 00222 { 00223 trace_with_mask("SigAction::SigAction", SIGACT); 00224 00225 m_sa.sa_flags = 0; 00226 sigemptyset(&m_sa.sa_mask); 00227 *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) 0; 00228 }
|
|
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.
Definition at line 232 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00235 { 00236 trace_with_mask("SigAction::SigAction(,,)", SIGACT); 00237 00238 m_sa.sa_flags = flags_; 00239 if (sig_mask_ == NULL) { 00240 sigemptyset(&m_sa.sa_mask); 00241 } 00242 else { 00243 /*--- 00244 here, suppose to do bitwise structure assignment, 00245 but does it really do so? 00246 = *sig_mask_ 00247 = *(sig_mask_.operator *()) 00248 = *(SigSet *tmp = &sig_mask_.m_sa) ???? 00249 ---*/ 00250 m_sa.sa_mask = **sig_mask_; 00251 } 00252 *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) handler_; 00253 }
|
|
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.
Definition at line 257 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00261 { 00262 trace_with_mask("SigAction::SigAction(,,,)", SIGACT); 00263 00264 m_sa.sa_flags = flags_; 00265 if (sig_mask_ == NULL) { 00266 sigemptyset(&m_sa.sa_mask); 00267 } 00268 else { 00269 /*--- same problem as above... ---*/ 00270 m_sa.sa_mask = **sig_mask_; 00271 } 00272 *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) handler_; 00273 00274 /*--- installing disposition... ---*/ 00275 sigaction (signum_, &m_sa, 0); 00276 }
|
|
Retrieve current sigaction.
Definition at line 288 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00289 { 00290 trace_with_mask("SigAction::action", SIGACT); 00291 00292 return &m_sa; 00293 }
|
|
Set sigaction structure to sa_.
Definition at line 280 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. Referenced by register_action(), and restore_action(). 00281 { 00282 trace_with_mask("SigAction::action", SIGACT); 00283 m_sa = *sa_; 00284 }
|
|
Retrieve current flags.
Definition at line 306 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00307 { 00308 trace_with_mask("int SigAction::flags()", SIGACT); 00309 00310 return m_sa.sa_flags; 00311 }
|
|
Set signal flags to new_flags_.
Definition at line 297 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00298 { 00299 trace_with_mask("void SigAction::flags()", SIGACT); 00300 00301 m_sa.sa_flags = new_flags_; 00302 }
|
|
Retrieve current signal handler function.
Definition at line 343 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00344 { 00345 trace_with_mask("C_SIG_HANDLER SigAction::handler()", SIGACT); 00346 00347 return (C_SIG_HANDLER) m_sa.sa_handler; 00348 }
|
|
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(), and ASSA::SigHandler::install(). 00335 { 00336 trace_with_mask("void SigAction::handler()", SIGACT); 00337 00338 *(C_SIG_HANDLER*) &m_sa.sa_handler = (C_SIG_HANDLER) sha_; 00339 }
|
|
Retrieve current signal mask.
Definition at line 324 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00325 { 00326 trace_with_mask("SigSet SigAction::mask()", SIGACT); 00327 00328 SigSet tmpset(&m_sa.sa_mask); 00329 return tmpset; 00330 }
|
|
Set new signal mask mask_set_.
Definition at line 315 of file SigAction.h. References m_sa, ASSA::SIGACT, and trace_with_mask. 00316 { 00317 trace_with_mask("void SigAction::mask()", SIGACT); 00318 00319 m_sa.sa_mask = *mask_set_; 00320 }
|
|
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. 00352 { 00353 trace_with_mask("SigAction::operator SIGACTION * ()", SIGACT); 00354 00355 return &m_sa; 00356 }
|
|
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.
Definition at line 360 of file SigAction.h. References action(), m_sa, ASSA::SIGACT, and trace_with_mask. Referenced by ASSA::SigHandler::install(), and ASSA::SigHandler::remove(). 00361 { 00362 trace_with_mask("SigAction::register_action()", SIGACT); 00363 00364 /*--- place here recursive mutex lock to guard ... ---*/ 00365 struct sigaction *osa = oaction_ == 0 ? 0 : oaction_->action(); 00366 return sigaction(signum_, &m_sa, osa); 00367 }
|
|
Change object's disposition to oaction_, and install it as current disposition for the signal signum_.
Definition at line 371 of file SigAction.h. References action(), m_sa, ASSA::SIGACT, and trace_with_mask. 00372 { 00373 trace_with_mask("SigAction::restore_action()", SIGACT); 00374 00375 m_sa = *oaction_.action(); 00376 return sigaction(signum_, &m_sa, 0); 00377 }
|
|
Retrieve current disposition for the signal signum_ into this object.
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(). 00382 { 00383 trace_with_mask("SigAction::retrieve_action()", SIGACT); 00384 00385 return sigaction(signum_, 0, &m_sa); 00386 }
|
|
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(). |