typedef void (*sighandler_t) (int); sighandler_t signal (int signum, sighandler_t handler);
SIG_DFL - use default signal handler
SIG_IGN - ignore the signal
struct sigaction
{
void (*sa_handler) (int);
void (*sa_sigaction) (int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
}
struct siginfo_t
{
int si_signo; // Signal number
int si_errno; // Value of errno
int si_code; // Additional signal code
pid_t si_pid; // Sending process PID
uid_t si_uid; // Sending process UID
int si_status; // Exit value
clock_t si_utime; // User time consumed
clock_t si_stime; // System time consumed
sigval_t si_value; // Signal value
int si_int; // Integer value sent with signal
void * si_ptr; // Pointer value sent with signal
void * si_addr; // Associated memory address
int si_fd; // Associated file descriptor
}
int sigaction (int signum, const struct sigaction *act, struct sigaction *oldact);
sa_handler - signal handler with limited arguments
sa_sigaction - signal handler with complete arguments
sa_mask - what other signals to mask while in signal handler
SA_RESETHAND - restore default signal handler after one signal
SA_NODEFER - allow recursive invocation of this signal handler
SA_ONSTACK - use alternate stack for this signal handler