sigvec(2) — 4 BSD
NAME
sigvec − software signal facilities
SYNOPSIS
#include <signal.h>
struct sigvec {
int(∗sv_handler)();
intsv_mask;
intsv_onstack;
};
int sigvec (sig, vec, ovec)
int sig;
struct sigvec ∗vec, ∗ovec;
DESCRIPTION
sigvec assigns a disposition for a specific signal, sig. See signal(5) for an explanation of general signal concepts.
If vec is non-zero, it specifies a handler routine and mask to be used when delivering the specified signal. Further, if sv_onstack is 1, the system will deliver the signal to the process on a signal stack, specified with sigstack(2). If ovec is non-zero, the previous handling information for the signal is returned to the user.
The default action for a signal may be reinstated by setting sv_handler to SIG_DFL; this default is usually termination [see signal(5)]. If sv_handler is SIG_IGN the signal is subsequently ignored, and pending instances of the signal are discarded. Otherwise, when a signal is delivered, the current state of the process is saved, a new signal mask is calculated (as described below), and the signal handler is invoked. The call to the handler is arranged so that if the signal handling routine returns normally the process will resume execution in the context from before the signal’s delivery. If the process wishes to resume in a different context, then it must arrange to restore the previous context itself.
For information on the signal handler interface, see signal(5).
When a signal is delivered to a process a new signal mask is installed for the duration of the process’ signal handler (or until a sigblock or sigsetmask call is made). This mask is formed by taking the current signal mask, adding the signal to be delivered, and or’ing in the signal mask associated with the handler to be invoked.
The mask specified in vec is not allowed to block SIGKILL or SIGSTOP. This is enforced silently by the system.
A return from the function unblocks the handled signal and continues the process at the point it was interrupted. Unlike the signal(2) facilities, the handler func remains installed after a signal has been delivered.
If a caught signal occurs during certain system calls, causing the call to terminate prematurely, the call is automatically restarted. In particular this can occur during a read or write(2) on a slow device (such as a terminal; but not a file) and during a wait(2).
RETURN VALUE
A 0 value indicated that the call succeeded. A −1 return value indicates an error occured and errno is set to indicated the reason.
ERRORS
sigvec will fail and no new signal handler will be installed if one of the following occurs:
[EFAULT] Either vec or ovec points to memory which is not a valid part of the process address space.
[EINVAL] sig is not a valid signal number.
[EINVAL] An attempt is made to ignore or supply a handler for SIGKILL or SIGSTOP.
SEE ALSO
kill(1), ptrace(2), kill(2), sigaction(2), sigblock(2), sigsetmask(2), sigpause(2), sigstack(2), setjmp(3C), signal(5), sgtty(7).
CX/UX Programmer’s Reference Manual