This section describes alternative signal handling functions derived from BSD Unix. These facilities were an advance, in their time; today, they are mostly obsolete, and supported mainly for compatibility with BSD Unix.
There are many similarities between the BSD and POSIX signal handling facilities, because the POSIX facilities were inspired by the BSD facilities. Besides having different names for all the functions to avoid conflicts, the main differences between the two are:
BSD Unix represents signal masks as an int bit mask, rather than as a sigset_t object.
The BSD facilities use a different default for whether an interrupted primitive should fail or resume. The POSIX facilities make system calls fail unless you specify that they should resume. With the BSD facility, the default is to make system calls resume unless you say they should fail. the section called “Primitives Interrupted by Signals”.
The BSD facilities are declared in signal.h.
function>struct sigvec/function> This data type is the BSD equivalent of struct sigaction (the section called “Advanced Signal Handling”); it is used to specify signal actions to the sigvec function. It contains the following members:
This is the handler function.
This is the mask of additional signals to be blocked while the handler function is being called.
This is a bit mask used to specify various flags which affect the behavior of the signal. You can also refer to this field as sv_onstack.
These symbolic constants can be used to provide values for the sv_flags field of a sigvec structure. This field is a bit mask value, so you bitwise-OR the flags of interest to you together.
int function>SV_ONSTACK/function> If this bit is set in the sv_flags field of a sigvec structure, it means to use the signal stack when delivering the signal.
int function>SV_INTERRUPT/function> If this bit is set in the sv_flags field of a sigvec structure, it means that system calls interrupted by this kind of signal should not be restarted if the handler returns; instead, the system calls should return with a EINTR error status. the section called “Primitives Interrupted by Signals”.
int function>SV_RESETHAND/function> If this bit is set in the sv_flags field of a sigvec structure, it means to reset the action for the signal back to SIG_DFL when the signal is received.
int function>sigvec/function> (int signum, const struct sigvec *action,struct sigvec *old-action) This function is the equivalent of sigaction (the section called “Advanced Signal Handling”); it installs the action action for the signal signum, returning information about the previous action in effect for that signal in old-action.
int function>siginterrupt/function> (int signum, int failflag) This function specifies which approach to use when certain primitives are interrupted by handling signal signum. If failflag is false, signal signum restarts primitives. If failflag is true, handling signum causes these primitives to fail with error code EINTR. the section called “Primitives Interrupted by Signals”.
int function>sigmask/function> (int signum) This macro returns a signal mask that has the bit for signal signum set. You can bitwise-OR the results of several calls to sigmask together to specify more than one signal. For example,
(sigmask (SIGTSTP) | sigmask (SIGSTOP) | sigmask (SIGTTIN) | sigmask (SIGTTOU))
specifies a mask that includes all the job-control stop signals.
int function>sigblock/function> (int mask) This function is equivalent to sigprocmask (the section called “Process Signal Mask”) with a how argument of SIG_BLOCK: it adds the signals specified by mask to the calling process's set of blocked signals. The return value is the previous set of blocked signals.
int function>sigsetmask/function> (int mask) This function equivalent to sigprocmask (the section called “Process Signal Mask”) with a how argument of SIG_SETMASK: it sets the calling process's signal mask to mask. The return value is the previous set of blocked signals.
int function>sigpause/function> (int mask) This function is the equivalent of sigsuspend (the section called “Waiting for a Signal ”): it sets the calling process's signal mask to mask, and waits for a signal to arrive. On return the previous set of blocked signals is restored.