Struct sigaction is a data structure used to specify the action to be taken when a particular signal is recieved. It allows for advanced signal handling by providing options for setting a signal handler, blocking specific signals during the execution of the handler and defining flags that modify the behavior of the signal handling.
The field contained by the structure is:-
sa_handler: This is a pointer to the signal handler that takes a single integer parameter, that is the signal number.
sa_sigaction: This is a pointer to a signal handler that provides extended information about the signal. It has 3 parameters:-
int signum: The signal number.
siginfo_t *info: A pointer to the siginfo_t structure containing additional information about the signal.
void *context: A pointer to a ucontext_t structure containing the context in which the signal was recieved.
sa_mask: This field specifies the set of signals to be blocked while the signal handler is executing.
sa_flags: This field contains the flags that modify the behavior of the signal handling. Common flags are:-
SA_RESTART
SA_SIGINFO
SA_NOCLDSTOP
SA_NOCLDWAIT
SA_NODEFER
SA_RESETHAND
sa_restorer: This field is not supported by the latest systems. It was originally intended for a specifying a custom signal restorer function.