sigset(2) AT&T SYSTEM V sigset(2)
NAME
sigset, sighold, sigrelse, sigignore, sigpause - signal
management
SYNOPSIS
#include <signal.h>
void (*sigset (sig, func))()
int sig;
void (*func)();
int sighold (sig)
int sig;
int sigrelse (sig)
int sig;
int sigignore (sig)
int sig;
int sigpause (sig)
int sig;
DESCRIPTION
These functions provide signal management for application
processes. See signal(5) for an explanation of general sig-
nal concepts.
sigset specifies the system signal action to be taken upon
receipt of a signal. sig specifies the signal, which may be
any signal except SIGKILL and SIGSTOP. func specifies the
signal's disposition, which may be SIGDFL, SIGIGN,
SIGHOLD, or the address of a signal handler.
If func is SIGDFL, the default action for signal sig is
reinstated; this default is usually termination [see sig-
nal(5)]. If func is SIGIGN the signal is subsequently
ignored and pending instances of the signal are discarded.
If func is SIGHOLD the signal is held upon receipt (and its
previous disposition is otherwise unaffected). Any pending
signal of this type remains held. Only one signal of each
type is held. Otherwise, when the signal occurs further
occurences of the signal are automatically blocked and func
is called.
For information on the signal handler interface, see sig-
nal(5).
When a signal handler function is specified for a signal
being delivered, the system adds sig to the calling
process's signal mask before executing the signal handler;
when the signal handler returns, the system restores the
Page 1 CX/UX Programmer's Reference Manual
sigset(2) AT&T SYSTEM V sigset(2)
calling process's signal mask to its state prior to the
delivery of the signal. If a non-local goto (longjmp) is
taken, then sigrelse must be called to restore the system
signal action and release any held signal of this type.
In general, upon return from the signal-catching handler,
the receiving process will resume execution at the point it
was interrupted. However, when a signal is caught during a
read(2), a write(2), an open(2), or an ioctl(2) system call
on a slow device, during a pause(2) system call, or during a
wait(2) system call that does not return immediately due to
the existence of a previously stopped or zombie process, the
signal-catching handler will be executed and then the inter-
rupted system call may return a -1 to the calling process
with errno set to EINTR.
Unlike the signal(2) facilities, the handler func remains
installed after a signal has been delivered.
sighold and sigrelse are used to establish critical regions
of code. sighold adds sig to the calling process's signal
mask; it is analogous to raising the priority level and
deferring or holding a signal until the priority is lowered
by sigrelse. sigrelse removes sig from the calling
process's signal mask, restoring the system signal action to
that specified previously by sigset.
sigignore sets the action for signal sig to SIGIGN (see
above).
sigpause suspends the calling process until it receives a
signal, the same as pause(2). However, if the signal sig
had been received and held, it is released (removed from the
current signal mask) and the system signal action taken.
This system call is useful for testing variables that are
changed on the occurrence of a signal. The correct usage is
to use sighold to block the signal first, then test the
variables. If they have not changed, then call sigpause to
wait for the signal. When the sigpause returns, the origi-
nal signal mask is restored.
RETURN VALUE
Upon successful completion, sigset returns the previous
value of the system signal action for the specified signal
sig, or SIGHOLD if it had been blocked. Otherwise, a value
of SIGERR is returned and errno is set to indicate the
error. SIGERR is defined in <signal.h>.
For the other functions, upon successful completion, a value
of 0 is returned. Otherwise, a value of -1 is returned and
errno is set to indicate the error.
Page 2 CX/UX Programmer's Reference Manual
sigset(2) AT&T SYSTEM V sigset(2)
ERRORS
These functions will fail if one or more of the following
are true:
[EINVAL] sig is an illegal signal number (including
SIGKILL and SIGSTOP) or the default handling
of sig cannot be changed.
[EINTR] A signal was caught during the system call
sigpause.
SEE ALSO
kill(2), pause(2), sigaction(2), signal(2), wait(2),
setjmp(3C), signal(5).
NOTES
If the disposition of SIGCHLD is set to a signal handler,
SIGCHLD will not be sent when the calling process's children
are stopped or continued.
If the disposition of SIGCHLD is set to SIGIGN, the calling
process's child processes will not create zombie processes
when they terminate [see exit(2)]. If the calling process
subsequently waits for its children, it blocks until all of
its children terminate; it then returns a value of -1 with
errno set to ECHILD [see wait(2), sigaction(2), signal(5)].
The other signal management functions, signal(2) and
pause(2), should not be used in conjunction with these rou-
tines for a particular signal type.
Page 3 CX/UX Programmer's Reference Manual