Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sighold(2V) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

kill(2)

signal(2)

pause(2)

wait(2)

abort(3C)

setjmp(3C)

signal(5)

SIGSET(2V)

NAME

sigset, sighold, sigrelse, sigignore, sigpause − signal management

SYNOPSIS

#include <signal.h>

void (∗ sigset ( sig, func ))()
int sig;
int (∗ func )();
int sighold (sig)
int sig;
int sigrelse (sig)
int sig;
int sigignore (sig)
int sig;
int sigpause (sig)
int sig;

DESCRIPTION

The system defines a set of signals that can be delivered to a process.  The set of signals is defined in signal(5), along with the meaning and side effects of each signal. An alternate mechanism for handling these signals is defined here. The facilities described here should not be used in conjunction with the other facilities described under signal(2), sigvector(2), sigblock(2), sigsetmask(2), sigpause(2) and sigspace(2).

Sigset allows the calling process to choose one of four ways to handle the receipt of a specific signal.  Sig specifies the signal and func specifies the choice. 

Sig can be any one of the signals described under signal(5) except SIGKILL or SIGSTOP.

Func is assigned one of four values: SIG_DFL, SIG_IGN, SIG_HOLD or a function address. The actions prescribed by SIG_DFL and SIG_IGN are described under signal(5). The action prescribed by SIG_HOLD and function address are described below:

SIG_HOLD Hold signal. 
The signal sig is held upon receipt.  Any pending signal of this signal type remains held.  Only one signal of each type is held. 
Note: the signals SIGKILL, SIGCONT and SIGSTOP cannot be held.

function address Catch signal. 
Func must be a pointer to a function, the signal-catching handler, that is called when signal sig occurs.  Sigset specifies that the process calls this function upon receipt of signal sig.  Any pending signal of this type is released.  This handler address is retained across calls to the other signal management functions listed here.  Upon receipt of the signal sig, the receiving process executes the signal-catching function pointed to by func as described under signal(5) with the following differences:
Before calling the signal-catching handler, the system signal action of sig is set to SIG_HOLD.  During a normal return from the signal-catching handler, the system signal action is restored to func and any held signal of this type is released.  If a non-local goto (longjmp(3C)) is taken, sigrelse must be called to restore the system signal action to func and release any held signal of this type. 

Sighold(2) holds the signal sig.  Sigrelse(2) restores the system signal action of sig to that specified previously by sigset.  Sighold and sigrelse are used to establish critical regions of code.  Sighold is analogous to raising the priority level and deferring or holding a signal until the priority is lowered by sigrelse. 

Sigignore sets the action for signal sig to SIG_IGN.  (See signal(5)).

Sigpause suspends the calling process until it receives an unblocked signal.  If the signal sig is held, it is released before the process pauses.  Sigpause is useful for testing variables that are changed when a signal occurs.  For example, sighold should be used to block the signal first, then test the variables.  If they have not changed, call sigpause to wait for the signal. 

These functions can be linked into a program by giving the −lV3 option to ld(1).

RETURN VALUE

Upon successful completion, sigset returns the previous value of the system signal action for the specified signal sig.  Otherwise, a value of SIG_ERR is returned and errno is set to indicate the error.  SIG_ERR is defined in <signal.h>. 

For the other functions, a 0 value indicates that the call succeeded.  A −1 return value indicates an error occurred and errno is set to indicate the reason. 

ERRORS

The sigset function fails and the system signal action for sig is not changed if the following occurs:

[EFAULT] The func argument points to memory that is not a valid part of the process address space.  The reliable detection of this error is implementation dependent. 

The sigset, sighold, sigrelse, sigignore, and sigpause functions fail and the system signal action for sig is not changed if one of the following occurs:

[EINVAL] Sig is not a valid signal number. 

[EINVAL] An attempt is made to ignore, hold, or supply a handler for a signal that cannot be ignored, held, or caught; see signal(5).

The sigpause function returns when the following occurs:

[EINTR] A signal was caught. 

WARNINGS

These signal facilities should not be used in conjunction with bsdproc(2), signal(2), sigvector(2), sigblock(2), sigsetmask(2), sigpause(2) and sigspace(2).

SEE ALSO

kill(1), kill(2), signal(2), pause(2), wait(2), abort(3C), setjmp(3C), signal(5). 

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026