sigvec
Purpose
Selects enhanced signal facilities.
Syntax
#include <sys/signal.h>
int sigvec (sig, invec, outvec)
int sig;
struct sigvec *invec, *outvec;
Description
The sigvec system call allows the user to select standard
or enhanced signal-handling facilities. Like the signal
system call, it sets the action to take upon the receipt
of a signal, but it also sets additional features.
The sigvec system call assigns a handler for a specific
signal. If the invec parameter is nonzero, it points to
a sigvec structure that specifies a handler routine and
mask to be used when delivering the specified signal.
The sigvec structure has the following members:
int (*sv_handler) ( );
int sv_mask;
int sv_onstack;
If the SIG_STK bit of sv_onstack is set, then the system
runs the handler on the signal stack specified by the
sigstack system call. If this bit is not set, then the
handler executes on the stack of the interrupted process.
If the SIG_STD bit of sv_onstack is set, then standard
signal processing is used. If this bit is not set, then
enhanced signal processing is used.
The default action for a signal can be reinstated by
setting sv_handler to SIG_DFL. If sv_handler is set to
SIG_IGN, then the signal is ignored, and pending
instances of the signal are discarded. See "signal" for
a detailed description of the default signal actions.
If the outvec parameter is nonzero, then the previous
handling information for the signal is stored in the
sigvec structure pointed to by outvec.
If the value of the invec parameter is 0 (that is, a NULL
pointer), then the signal handler information is not set.
If the value of the outvec parameter is 0, then the pre-
vious signal handler information is not reported.
Once a signal handler is assigned, it remains assigned
until another sigvec, signal, or exec system call is
made.
Warning: The sigvec system call does not check the
validity of the sv_handler pointer. If it &pointsout.,
then the process receives a memory fault when the system
attempts to call the signal handler. If sv_handler
points to anything other than a subroutine, then the
results are unpredictable.
The signal-handler subroutine can be declared as follows:
handler (sig, code, scp)
int sig, code;
struct sigcontext *scp;
The sig parameter is the signal number. The code param-
eter is provided only for compatibility with other
UNIX-compatible systems, and its value is always 0. The
scp parameter points to the sigcontext structure that is
later used to restore the process's previous execution
context. The sigcontext structure is defined in
signal.h.
Note: The sigcontext structure contains fields for
saving the values of the floating-point registers. On a
SIGFPE signal, the values in all of the registers are
saved. On all other signals, only the first eight regis-
ters are saved.
Refer to "BSD 4.3 library" for additional information on
the differences between AIX and 4.3BSD signal handling.
Return Value
Upon successful completion, a value of 0 is returned. If
the sigvec system call fails, a value of -1 is returned
and errno is set to indicate the error.
Diagnostics
The sigvec system call fails and no new signal handler is
installed if one of the following occurs:
EFAULT The invec or outvec parameter &pointsout.
EINVAL The sig parameter is not a valid signal
number.
EINVAL An attempt was made to ignore or supply a
handler for SIGKILL.
Related Information
In this book: "BSD 4.3 library," "kill," "ptrace,"
"sigblock," "sigpause," "sigstack," "sigsetmask,"
"sigvec," and "setjmp, longjmp."
The kill command in AIX Operating System Commands Refer-
ence.