sigvec(2)
_________________________________________________________________
sigvec System Call
Specify what to do upon presentation of a signal.
_________________________________________________________________
SYNTAX
#include <signal.h>
int sigvec (signal_number, new_signal_vector, old_signal_vector)
int signal_number;
struct sigvec * new_signal_vector;
struct sigvec * old_signal_vector;
PARAMETERS
signal_number Type of signal.
new_signal_vector
NULL or address of new handler specifier.
old_signal_vector
NULL or address of old handler specifier.
DESCRIPTION
Sigvec is used to install a new handler and retrieve the previous
handler for signal <signal_number>. A handler for the signal is
optionally installed using the <new_signal_vector> parameter. If
<new_signal_vector> is NULL, the handler remains unchanged.
Otherwise, <new_signal_vector> is installed. The previous
handler for the signal may be obtained by the <old_signal_vector>
parameter. If <old_signal_vector> is NULL, the previous handler
is not returned. Otherwise, the previous handler information is
stored in the location pointed to by <old_signal_vector>.
<Signal_number> may be any of the valid signals except SIGKILL or
SIGSTOP. See signal.h for a complete list.
A signal handler has three components: a set of flags
(sv_flags), a signal mask (sv_mask), and an action (sv_handler).
Each signal handler may choose to execute on either the current
stack of the calling process or on a special signal stack. The
process must have previously defined the signal stack using
sigstack. The handler's stack choice is indicated by a flag in
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
sigvec(2)
sv_flags. Setting the flag SV_ONSTACK chooses the signal stack
of the calling process; otherwise the current stack is used. The
stack address is chosen when the signal is presented. Thus,
subsequent sigstack operations may redirect the handler's signal
stack.
The handler's signal mask is an additional set of signals that
are to be blocked from presentation while the signal is being
handled. The set of signals that are blocked while the signal is
being handled is the union of the handler's signal mask, the
signal that occurred, and the process's current set of blocked
signals.
Signal "s" is represented by the value "sigmask(s)" in sv_mask.
The handler's action chooses one of three ways to handle the
receipt of a signal. <new_signal_vector.sv_handler> may be
assigned one of the values: SIG_DFL, SIG_IGN, or function
address. The actions prescribed by these values are as follows.
SIGDFL - Default signal action.
The process's signal action vector entry for <signal_number> is
set to `default'.
When the signal <signal_number> is sent to the process, it may be
pended depending on the state of the blocked signal vector. When
the signal is presented to the process, it will cause the process
to either terminate, stop, ignore the signal, or terminate with a
core dump depending on the signal's type (see signal.h).
If a core dump is indicated, the receiving process must have
adequate permission to do so.
SIGIGN - Ignore signal.
The process's signal action vector entry for <signal_number> is
set to `ignore'.
When the signal <signal_number> is sent to the process, it may be
pended depending on the state of the blocked signal vector. When
the signal is presented to the process, it will be discarded.
SIGKILL, SIGSTOP, and SIGCONT cannot be ignored.
function_address - Catch signal.
The process's signal action vector entry for <signal_number> is
set to `catch'.
When the signal <signal_number> is sent to the process, it may be
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
sigvec(2)
pended depending on the state of the blocked signal vector. When
the signal is presented to the process, it will cause the signal
handler specified by <action> to be invoked.
The following attributes are set for the signal action vector
entry for <signal_number>:
* The signal mask addend is set to the union of
<new_signal_vector.sv_mask> and <signal_number>. These
signals are added to the blocked signal vector for the
duration of the signal handler's invocation.
* The signal stack choice is set based on the flag
<SV_ONSTACK>. This may cause a stack switch to take place
for the duration of the signal handler's invocation.
* The new signal action is set to `unchanged'. The occurrence
of multiple signals will not cause the loss of signals or
process termination.
* The restart system call choice is set based on the flag
<SV_INTERRUPT>. If the flag is set, system calls
interrupted by signal <signal_number> will be be terminated
with errno set to EINTR rather than being restarted.
SIGKILL and SIGSTOP cannot be caught.
After a fork, the child process inherits all software signal
structures, except that the pending signal vector is cleared.
Exec modifies the software signal structures in the following
manner: 1) The signal action for signals set to `catch' is
changed to `default'. 2) The signal stack context is discarded.
3) All other software signal structures are unchanged.
The mask specified in <new_signal_vector> is not allowed to block
SIGKILL, SIGSTOP, or SIGCONT. This is done silently by the
system.
Sigvec will fail and the signal handler will be unchanged if an
error occurs.
ACCESS CONTROL
No access is required to install a signal handler.
The receiving process is granted permission to produce a core
dump file provided
* the effective-user-id and the real-user-id of the receiving
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)
sigvec(2)
process are equal, and
* the receiving process has adequate file system permission to
create or rewrite the core dump file.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. Errno is set to indicate the
error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EFAULT Either <new_signal_vector> or <old_signal_vector>
point to memory which is not a valid part of the
process address space.
EINVAL <Signal_number> is not a valid signal number.
EINVAL An attempt is made to ignore or supply a handler
for SIGKILL or SIGSTOP.
EINVAL An attempt is made to ignore SIGCONT.
SEE ALSO
The related system calls: ptrace, kill, sigblock, sigsetmask,
sigpause sigstack, sigvec.
The related manual sections: kill(1), setjmp(3), tty(4)
DG/UX 4.00 Page 4
Licensed material--property of copyright holder(s)