Signal-management APIs
Applications are provided with various APIs for managing signals; we shall take a look at few of the important ones:
Sigaction(): User-mode processes use the POSIX APIsigaction()to examine or change the disposition of a signal. This API provides a variety of attribute flags that can further define the behavior of a signal:
#include <signal.h>
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
The sigaction structure is defined as something like:
struct sigaction {
void (*sa_handler)(int);
void (*sa_sigaction)(int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
void (*sa_restorer)(void);
};int signumis the identifier number of a recognizedsignal.sigaction()examines and sets the action to be associated with this signal.const struct sigaction *actcan beassigned with the address of astruct sigactioninstance. The action specified in this structure becomes the new action bound to the signal. When the act pointer...