1
0
Files
irix-657m-src/eoe/man/man2/sigset.2
2022-09-29 17:59:04 +03:00

155 lines
4.1 KiB
Groff

'\"! tbl | mmdoc
'\"macro stdmacro
.if n .pH g2.sigset @(#)sigset 30.10 of 3/24/86
.TH SIGSET 2
.SH NAME
sigset, sighold, sigrelse, sigignore, sigpause \- signal management (System V)
.Op c p a
.SH C SYNOPSIS
.B #include <signal.h>
.nf
.PP
\f4C:\f1
.br
.B " void (\(**sigset (int sig, void (\(**disp)()))();"
\f4C++:\f1
.br
.B " void (\(**sigset (int sig, void (\(**disp)(int)))(int);"
.sp
\f4#if _XOPEN_SOURCE\f1
.br
.B " void (\(**sigset (int sig, void (\(**disp)(int)))(int);"
\f4#endif\f1
.PP
.B "int sighold (int sig);"
.PP
.B "int sigrelse (int sig);"
.PP
.B "int sigignore (int sig);"
.PP
.B "int sigpause (int sig);"
.fi
.Op
.Op f
.SH FORTRAN SYNOPSIS
.nf
.PP
.B "integer *4 function sighold (sig)"
.B "integer *4 sig"
.PP
.B "integer *4 function sigrelse (sig)"
.B "integer *4 sig"
.PP
.B "integer *4 function sigignore (sig)"
.B "integer *4 sig"
.PP
.B "integer *4 function sigpause (sig)"
.B "integer *4 sig"
.fi
.Op
.SH DESCRIPTION
These functions provide signal management for application processes.
\f4sigset\fP
specifies the system signal action to be taken upon receipt of signal
\f2sig\fP.
\f2disp\fP specifies the signal's disposition, which may be \f4SIG_DFL\fP,
\f4SIG_IGN\fP, or the address of a signal handler.
If \f2disp\fP is the address of a signal handler, the system adds \f2sig\fP
to the calling process's signal mask before executing the signal
handler; when the signal handler returns, the system restores the calling
process's signal mask to its state prior to the delivery of the signal.
In addition, if \f2disp\fP is equal to \f4SIG_HOLD\fP, \f2sig\fP is added
to the calling process's signal mask and the signal's disposition
remains unchanged.
If \f2disp\fP is not equal to \f4SIG_HOLD\fP, \f2sig\fP will be removed
from the calling process's signal mask (this behavior is different
than \f4sigaction\fP(2)).
.PP
\f4sighold\fP adds \f2sig\fP to the calling process's signal mask.
.PP
\f4sigrelse\fP removes \f2sig\fP from the calling process's signal mask.
.PP
\f4sigignore\fP sets the disposition for \f2sig\fP to \f4SIG_IGN\fP.
.PP
\f4sigpause\fP removes \f2sig\fP from the calling process's signal mask
and suspends the calling process until a signal is received.
This system call is useful for testing variables
that are changed on the occurrence of a signal.
The correct usage is to use \f4sighold\fP
to block the signal first, then test the variables.
If they have not changed, then call \f4sigpause\fP
to wait for the signal.
.PP
For a list of valid signal numbers and a general description
of the signal mechanism, please see \f4signal\fP(5).
.PP
These functions will fail if one or more of the following are true:
.TP 10
.SM
\%[EINVAL]
\f2sig\fP
is an illegal signal number (including \f4\s-1SIGKILL\s0\f1
and \f4\s-1SIGSTOP\s0\f1) or the default handling of
\f2sig\fP
cannot be changed.
.TP
.SM
\%[EINVAL]
The requested action is illegal (e.g. ignoring \f4\s-1SIGCONT\s0\f1,
which is ignored by default).
.TP
.SM
\%[EINTR]
A signal was caught during the system call
\f4sigpause\fP.
.Op
.Op f
.SH EXAMPLES
This is an example in FORTRAN:
.nf
#include <sys/signal.h>
EXTERNAL FPROC
INTEGER SIGSET
INTEGER CPADDR
I = SIGSET(SIGTERM, FPROC, -1)
J = SIGSET(SIGINT, 0, CPADDR)
.fi
The first call to \f4sigset\f1 sets up the FORTRAN function
\f2fproc\f1 as the signal-handling routine for \f4\s-1SIGTERM\s+1\f1.
The second call sets up a C function whose address is in the variable
\f2cpaddr\f1 as the signal-handling routine for \f4\s-1SIGINT\s+1\f1.
.Op
.PP
.SH DIAGNOSTICS
Upon successful completion,
\f4sigset\fP
returns \f4SIG_HOLD\fP if the signal had been blocked or the
signal's previous disposition if it had not been blocked.
Otherwise, a value of
.B \s-1SIG_ERR\s0
is returned and
.I errno\^
is set to indicate the error.
.B \s-1SIG_ERR\s0
is defined in
.IR <sys/signal.h> .
.PP
For the other functions,
upon successful completion,
a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.I errno\^
is set to indicate the error.
.SH SEE ALSO
csh(1), blockproc(2), kill(2), pause(2), setrlimit(2), sigaction(2),
signal(2), ulimit(2),
wait(2),
setjmp(3C), sigvec(3B), signal(5), siginfo(5).
.so warnings
.Ee
'\".so /pubs/tools/origin.att