HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
s
sigvector(2) sigvector(2)
(TO BE OBSOLETED)
NAME
sigvector - software signal facilities
SYNOPSIS
#include <signal.h>
int sigvector(
int sig,
const struct sigvec *vec,
struct sigvec *ovec
);
DESCRIPTION
The system defines a set of signals that can be delivered to a process. The set of signals is defined in sig-
nal(5), along with the meaning and side effects of each signal. This manual entry, along with those for sig-
block(2), sigsetmask(2), sigpause(3C), and sigspace(2), defines an alternate mechanism for handling these
signals that ensures the delivery of signals and the integrity of signal handling procedures. The facilities
described here should not be used in the same program as signal(2).
With the sigvector() interface, signal delivery resembles the occurrence of a hardware interrupt: the
signal is blocked from further occurrence, the current process context is saved, and a new one is built. A
process can specify a handler function to be invoked when a signal is delivered, or specify that a signal
should be blocked or ignored. A process can also specify that a default action should be taken by the system
when a signal occurs. It is possible to ensure a minimum amount of stack space for processing signals
using sigspace() (see sigspace(2)).
All signals have the same priority. Signal routines execute with the signal that causes their invocation to
be blocked, although other signals can yet occur. A global signal mask defines the set of signals currently
blocked from delivery to a process. The signal mask for a process is initializedfrom that of its parent (nor-
mally 0). It can be changed with a sigblock(), sigsetmask() ,orsigpause() call, or when a sig-
nal is delivered to the process.
A signal mask is represented as a
long, with one bit representing each signal being blocked. The follow-
ing macro defined in <signal.h> is used to convert a signal number to its corresponding bit in the mask:
#define sigmask(signo) (1L << (signo-1))
When a signal condition arises for a process, the signal is added to a set of signals pending for the process.
If the signal is not currently blocked by the process, it is delivered to the process. 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 handlingroutine
returns normally, the process resumes execution in the same context as before the signal’s delivery. If the
process wishes to resume in a different context, it must arrange to restore the previous context itself.
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, computing the bit-wise inclusive OR with the value of vec.sv_mask (see below) from
the most recent call to sigvector() for the signal to be delivered, and, unless the SV_RESETHAND
flag is set (see below), setting the bit corresponding to the signal being delivered. When the user’s signal
handler returns normally, the original mask is restored.
sigvector() assigns a handler for the signal specified by sig. vec and ovec are pointers to sigvec struc-
tures that include the following elements:
void (*sv_handler)();
long
sv_mask;
long
sv_flags;
If vec is non-zero, it specifies a handler routine (sv_handler), a mask (sv_mask) that the system should use
when delivering the specified signal, and a set of flags (sv_flags) that modify the delivery of the signal. If
ovec is non-zero, the previous handling information for the signal is returned to the user. If vec is zero, sig-
nal handling is unchanged. Thus, the call can be used to enquire about the current handling of a given sig-
nal. If vec and ovec point to the same structure, the value of vec is read prior to being overwritten.
The sv_flags field can be used to modify the receipt of signals. The following flag bits are defined:
SV_ONSTACK Use the sigspace() allocated space.
HP-UX Release 11i: December 2000 1 Section 2369
___
___