|
Packit |
7cfc04 |
'\" et
|
|
Packit |
7cfc04 |
.TH SIGHOLD "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH PROLOG
|
|
Packit |
7cfc04 |
This manual page is part of the POSIX Programmer's Manual.
|
|
Packit |
7cfc04 |
The Linux implementation of this interface may differ (consult
|
|
Packit |
7cfc04 |
the corresponding Linux manual page for details of Linux behavior),
|
|
Packit |
7cfc04 |
or the interface may not be implemented on Linux.
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
sighold,
|
|
Packit |
7cfc04 |
sigignore,
|
|
Packit |
7cfc04 |
sigpause,
|
|
Packit |
7cfc04 |
sigrelse,
|
|
Packit |
7cfc04 |
sigset
|
|
Packit |
7cfc04 |
\(em signal management
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
#include <signal.h>
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
int sighold(int \fIsig\fP);
|
|
Packit |
7cfc04 |
int sigignore(int \fIsig\fP);
|
|
Packit |
7cfc04 |
int sigpause(int \fIsig\fP);
|
|
Packit |
7cfc04 |
int sigrelse(int \fIsig\fP);
|
|
Packit |
7cfc04 |
void (*sigset(int \fIsig\fP, void (*\fIdisp\fP)(int)))(int);
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
Use of any of these functions is unspecified in a multi-threaded
|
|
Packit |
7cfc04 |
process.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsighold\fR(),
|
|
Packit |
7cfc04 |
\fIsigignore\fR(),
|
|
Packit |
7cfc04 |
\fIsigpause\fR(),
|
|
Packit |
7cfc04 |
\fIsigrelse\fR(),
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
functions provide simplified signal management.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
function shall modify signal dispositions. The
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
argument specifies the signal, which may be any signal except SIGKILL
|
|
Packit |
7cfc04 |
and SIGSTOP. The
|
|
Packit |
7cfc04 |
.IR disp
|
|
Packit |
7cfc04 |
argument specifies the signal's disposition, which may be SIG_DFL,
|
|
Packit |
7cfc04 |
SIG_IGN, or the address of a signal handler. If
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
is used, and
|
|
Packit |
7cfc04 |
.IR disp
|
|
Packit |
7cfc04 |
is the address of a signal handler, the system shall add
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
to the signal mask of the calling process before executing the signal
|
|
Packit |
7cfc04 |
handler; when the signal handler returns, the system shall restore the
|
|
Packit |
7cfc04 |
signal mask of the calling process to its state prior to the delivery
|
|
Packit |
7cfc04 |
of the signal. In addition, if
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
is used, and
|
|
Packit |
7cfc04 |
.IR disp
|
|
Packit |
7cfc04 |
is equal to SIG_HOLD,
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
shall be added to the
|
|
Packit |
7cfc04 |
signal mask of the calling process and
|
|
Packit |
7cfc04 |
.IR sig 's
|
|
Packit |
7cfc04 |
disposition shall remain unchanged. If
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
is used, and
|
|
Packit |
7cfc04 |
.IR disp
|
|
Packit |
7cfc04 |
is not equal to SIG_HOLD,
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
shall be removed from the signal mask of the calling process.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsighold\fR()
|
|
Packit |
7cfc04 |
function shall add
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
to the signal mask of the calling process.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigrelse\fR()
|
|
Packit |
7cfc04 |
function shall remove
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
from the signal mask of the calling process.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigignore\fR()
|
|
Packit |
7cfc04 |
function shall set the disposition of
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
to SIG_IGN.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigpause\fR()
|
|
Packit |
7cfc04 |
function shall remove
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
from the signal mask of the calling process and suspend the calling process
|
|
Packit |
7cfc04 |
until a signal is received. The
|
|
Packit |
7cfc04 |
\fIsigpause\fR()
|
|
Packit |
7cfc04 |
function shall restore the signal mask of the process to its original
|
|
Packit |
7cfc04 |
state before returning.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the action for the SIGCHLD signal is set to SIG_IGN, child processes
|
|
Packit |
7cfc04 |
of the
|
|
Packit |
7cfc04 |
calling processes shall not be transformed into zombie processes when
|
|
Packit |
7cfc04 |
they terminate. If the calling process subsequently waits for its
|
|
Packit |
7cfc04 |
children, and the process has no unwaited-for children that were
|
|
Packit |
7cfc04 |
transformed into zombie processes, it shall block until all of its
|
|
Packit |
7cfc04 |
children terminate, and
|
|
Packit |
7cfc04 |
\fIwait\fR(),
|
|
Packit |
7cfc04 |
\fIwaitid\fR(),
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIwaitpid\fR()
|
|
Packit |
7cfc04 |
shall fail and set
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.BR [ECHILD] .
|
|
Packit |
7cfc04 |
.SH "RETURN VALUE"
|
|
Packit |
7cfc04 |
Upon successful completion,
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
shall return SIG_HOLD if the signal had been blocked and the signal's
|
|
Packit |
7cfc04 |
previous disposition if it had not been blocked. Otherwise, SIG_ERR
|
|
Packit |
7cfc04 |
shall be returned and
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
set to indicate the error.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigpause\fR()
|
|
Packit |
7cfc04 |
function shall suspend execution of the thread until a signal is
|
|
Packit |
7cfc04 |
received, whereupon it shall return \(mi1 and set
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.BR [EINTR] .
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For all other functions, upon successful completion, 0 shall be returned.
|
|
Packit |
7cfc04 |
Otherwise, \(mi1 shall be returned and
|
|
Packit |
7cfc04 |
.IR errno
|
|
Packit |
7cfc04 |
set to indicate the error.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
These functions shall fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR EINVAL
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR sig
|
|
Packit |
7cfc04 |
argument is an illegal signal number.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIsigignore\fR()
|
|
Packit |
7cfc04 |
functions shall fail if:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BR EINVAL
|
|
Packit |
7cfc04 |
An attempt is made to catch a signal that cannot be caught, or to
|
|
Packit |
7cfc04 |
ignore a signal that cannot be ignored.
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.IR "The following sections are informative."
|
|
Packit |
7cfc04 |
.SH EXAMPLES
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "APPLICATION USAGE"
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigaction\fR()
|
|
Packit |
7cfc04 |
function provides a more comprehensive and reliable mechanism for
|
|
Packit |
7cfc04 |
controlling signals; new applications should use the
|
|
Packit |
7cfc04 |
\fIsigaction\fR()
|
|
Packit |
7cfc04 |
function instead of the obsolescent
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
function.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsighold\fR()
|
|
Packit |
7cfc04 |
function, in conjunction with
|
|
Packit |
7cfc04 |
\fIsigrelse\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIsigpause\fR(),
|
|
Packit |
7cfc04 |
may be used to establish critical regions of code that require the
|
|
Packit |
7cfc04 |
delivery of a signal to be temporarily deferred. For broader
|
|
Packit |
7cfc04 |
portability, the
|
|
Packit |
7cfc04 |
\fIpthread_sigmask\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIsigprocmask\fR()
|
|
Packit |
7cfc04 |
functions should be used instead of the obsolescent
|
|
Packit |
7cfc04 |
\fIsighold\fR()
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
\fIsigrelse\fR()
|
|
Packit |
7cfc04 |
functions.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For broader portability, the
|
|
Packit |
7cfc04 |
\fIsigsuspend\fR()
|
|
Packit |
7cfc04 |
function should be used instead of the obsolescent
|
|
Packit |
7cfc04 |
\fIsigpause\fR()
|
|
Packit |
7cfc04 |
function.
|
|
Packit |
7cfc04 |
.SH RATIONALE
|
|
Packit |
7cfc04 |
Each of these historic functions has a direct analog in the other
|
|
Packit |
7cfc04 |
functions which are required to be per-thread and thread-safe (aside
|
|
Packit |
7cfc04 |
from
|
|
Packit |
7cfc04 |
\fIsigprocmask\fR(),
|
|
Packit |
7cfc04 |
which is replaced by
|
|
Packit |
7cfc04 |
\fIpthread_sigmask\fR()).
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigset\fR()
|
|
Packit |
7cfc04 |
function can be implemented as a simple wrapper for
|
|
Packit |
7cfc04 |
\fIsigaction\fR().
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsighold\fR()
|
|
Packit |
7cfc04 |
function is equivalent to
|
|
Packit |
7cfc04 |
\fIsigprocmask\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIpthread_sigmask\fR()
|
|
Packit |
7cfc04 |
with SIG_BLOCK set. The
|
|
Packit |
7cfc04 |
\fIsigignore\fR()
|
|
Packit |
7cfc04 |
function is equivalent to
|
|
Packit |
7cfc04 |
\fIsigaction\fR()
|
|
Packit |
7cfc04 |
with SIG_IGN set. The
|
|
Packit |
7cfc04 |
\fIsigpause\fR()
|
|
Packit |
7cfc04 |
function is equivalent to
|
|
Packit |
7cfc04 |
\fIsigsuspend\fR().
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
\fIsigrelse\fR()
|
|
Packit |
7cfc04 |
function is equivalent to
|
|
Packit |
7cfc04 |
\fIsigprocmask\fR()
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
\fIpthread_sigmask\fR()
|
|
Packit |
7cfc04 |
with SIG_UNBLOCK set.
|
|
Packit |
7cfc04 |
.SH "FUTURE DIRECTIONS"
|
|
Packit |
7cfc04 |
These functions may be removed in a future version.
|
|
Packit |
7cfc04 |
.SH "SEE ALSO"
|
|
Packit |
7cfc04 |
.IR "Section 2.4" ", " "Signal Concepts",
|
|
Packit |
7cfc04 |
.IR "\fIexec\fR\^",
|
|
Packit |
7cfc04 |
.IR "\fIpause\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIpthread_sigmask\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIsigaction\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIsignal\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIsigsuspend\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIwait\fR\^(\|)",
|
|
Packit |
7cfc04 |
.IR "\fIwaitid\fR\^(\|)"
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "\fB<signal.h>\fP"
|
|
Packit |
7cfc04 |
.SH COPYRIGHT
|
|
Packit |
7cfc04 |
Portions of this text are reprinted and reproduced in electronic form
|
|
Packit |
7cfc04 |
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
|
|
Packit |
7cfc04 |
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Packit |
7cfc04 |
Specifications Issue 7, Copyright (C) 2013 by the Institute of
|
|
Packit |
7cfc04 |
Electrical and Electronics Engineers, Inc and The Open Group.
|
|
Packit |
7cfc04 |
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
|
|
Packit |
7cfc04 |
event of any discrepancy between this version and the original IEEE and
|
|
Packit |
7cfc04 |
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
Packit |
7cfc04 |
is the referee document. The original Standard can be obtained online at
|
|
Packit |
7cfc04 |
http://www.unix.org/online.html .
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
Any typographical or formatting errors that appear
|
|
Packit |
7cfc04 |
in this page are most likely
|
|
Packit |
7cfc04 |
to have been introduced during the conversion of the source files to
|
|
Packit |
7cfc04 |
man page format. To report such errors, see
|
|
Packit |
7cfc04 |
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|