Loading...
Searching...
No Matches
SigAction.h File Reference

SigAction is a C++ wrapper around sigaction structure. More...

`#include <signal.h>`
`#include <errno.h>`
`#include "assa/Assure.h"`
`#include "assa/SigSet.h"`

Go to the source code of this file.

## Classes

class | ASSA::SigAction

## Namespaces

namespace | ASSA

## Typedefs

typedef struct sigaction | SIGACTION
typedef void(* | C_SIG_HANDLER) (int)

## Detailed Description

SigAction is a C++ wrapper around sigaction structure.

Class SigAction implements a C++ wrapper around struct sigaction. It class also provides a range of all possible operation that can be performed on it, including sigaction(2) system call.

struct sigaction is defined as:

       struct sigaction {
           void      (*sa_handler) ();
           sigset_t  sa_mask;
           int       sa_flags;
           void      (*sa_sigaction) (int, siginfo_t*, void*);
       };

It is used to set all the details of what your process should do when a signal arrives. It encapsulates the action to be taken on receipt of a particular signal.

The most important member is sa_handler, which takes a pointer to a function. This function will be invoked whenever the process gets a particular POSIX.1 signal.

Some of the member function of SigAction class take a parameter of type C_SIG_HANDLER.

It can be one of:

- "C" signal handling function (sa_handler above):
  void sig_handler (int signum)
- SIG_ERR
- SIG DFL takes default signal action when caught
- SIG_IGN ignores signal (for those that can be ignored)

The sa_mask mask for the signal action specifies a set of signals to be blocked while the signal handler is active. On the entry into the signal handler, that set of signals is added to a set of signals already being blocked from delivery when the signal is delivered to the process. In addition, the signal that caused the handler to be executed will also be blocked (SIGSTOP and SIGKILL cannot be blocked - this is enforced by the underlying OS).

Flags sa_flags in the set of flags ORed that allows to modify the delivery of the signal. POSIX.1 spec. defines only SA_NOCLDSTOP flag. All other flags are system-dependent. Consult your local sigaction(2) man page for details.

Because SigAction is a wrapper around sigaction(2), after sig_handler returns (and before anything else), the OS will reinstall current disposition for the signal. To reset signal's disposition to SIG_DFL, SUN Solaris OS uses flag SA_RESETHAND, and Linux OS uses SA_ONESHOT.

Definition in file SigAction.h.

## Typedef Documentation

## C_SIG_HANDLER

typedef void(* C_SIG_HANDLER) (int)

Definition at line 28 of file SigAction.h.

## SIGACTION

typedef struct sigaction SIGACTION

Definition at line 27 of file SigAction.h.