Files
oldlinux-files/study/Ref-docs/POSIX/susv3/functions/sighold.html
2024-02-19 00:25:23 -05:00

198 lines
8.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>sighold</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="sighold"></a> <a name="tag_03_686"></a><!-- sighold -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_686_01"></a>NAME</h4>
<blockquote>sighold, sigignore, sigpause, sigrelse, sigset - signal management</blockquote>
<h4><a name="tag_03_686_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/signal.h.html">signal.h</a>&gt;<br>
<br>
int sighold(int</tt> <i>sig</i><tt>);<br>
int sigignore(int</tt> <i>sig</i><tt>);<br>
int sigpause(int</tt> <i>sig</i><tt>);<br>
int sigrelse(int</tt> <i>sig</i><tt>);<br>
void (*sigset(int</tt> <i>sig</i><tt>, void (*</tt><i>disp</i><tt>)(int)))(int); <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_686_03"></a>DESCRIPTION</h4>
<blockquote>
<p>Use of any of these functions is unspecified in a multi-threaded process.</p>
<p>The <i>sighold</i>(), <i>sigignore</i>(), <i>sigpause</i>(), <i>sigrelse</i>(), and <i>sigset</i>() functions provide simplified
signal management.</p>
<p>The <i>sigset</i>() function shall modify signal dispositions. The <i>sig</i> argument specifies the signal, which may be any
signal except SIGKILL and SIGSTOP. The <i>disp</i> argument specifies the signal's disposition, which may be SIG_DFL, SIG_IGN, or
the address of a signal handler. If <i>sigset</i>() is used, and <i>disp</i> is the address of a signal handler, the system shall
add <i>sig</i> to the calling process' signal mask before executing the signal handler; when the signal handler returns, the system
shall restore the calling process' signal mask to its state prior to the delivery of the signal. In addition, if <i>sigset</i>() is
used, and <i>disp</i> is equal to SIG_HOLD, <i>sig</i> shall be added to the calling process' signal mask and <i>sig</i>'s
disposition shall remain unchanged. If <i>sigset</i>() is used, and <i>disp</i> is not equal to SIG_HOLD, <i>sig</i> shall be
removed from the calling process' signal mask.</p>
<p>The <i>sighold</i>() function shall add <i>sig</i> to the calling process' signal mask.</p>
<p>The <i>sigrelse</i>() function shall remove <i>sig</i> from the calling process' signal mask.</p>
<p>The <i>sigignore</i>() function shall set the disposition of <i>sig</i> to SIG_IGN.</p>
<p>The <i>sigpause</i>() function shall remove <i>sig</i> from the calling process' signal mask and suspend the calling process
until a signal is received. The <i>sigpause</i>() function shall restore the process' signal mask to its original state before
returning.</p>
<p>If the action for the SIGCHLD signal is set to SIG_IGN, child processes of the calling processes shall not be transformed into
zombie processes when they terminate. If the calling process subsequently waits for its children, and the process has no
unwaited-for children that were transformed into zombie processes, it shall block until all of its children terminate, and <a href=
"../functions/wait.html"><i>wait</i>()</a>, <a href="../functions/waitid.html"><i>waitid</i>()</a>, and <a href=
"../functions/waitpid.html"><i>waitpid</i>()</a> shall fail and set <i>errno</i> to [ECHILD].</p>
</blockquote>
<h4><a name="tag_03_686_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, <i>sigset</i>() shall return SIG_HOLD if the signal had been blocked and the signal's previous
disposition if it had not been blocked. Otherwise, SIG_ERR shall be returned and <i>errno</i> set to indicate the error.</p>
<p>The <i>sigpause</i>() function shall suspend execution of the thread until a signal is received, whereupon it shall return -1
and set <i>errno</i> to [EINTR].</p>
<p>For all other functions, upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and <i>errno</i> set
to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_686_05"></a>ERRORS</h4>
<blockquote>
<p>These functions shall fail if:</p>
<dl compact>
<dt>[EINVAL]</dt>
<dd>The <i>sig</i> argument is an illegal signal number.</dd>
</dl>
<p>The <i>sigset</i>() and <i>sigignore</i>() functions shall fail if:</p>
<dl compact>
<dt>[EINVAL]</dt>
<dd>An attempt is made to catch a signal that cannot be caught, or to ignore a signal that cannot be ignored.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_686_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_686_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The <a href="../functions/sigaction.html"><i>sigaction</i>()</a> function provides a more comprehensive and reliable mechanism
for controlling signals; new applications should use <a href="../functions/sigaction.html"><i>sigaction</i>()</a> rather than
<i>sigset</i>().</p>
<p>The <i>sighold</i>() function, in conjunction with <i>sigrelse</i>() or <i>sigpause</i>(), may be used to establish critical
regions of code that require the delivery of a signal to be temporarily deferred.</p>
<p>The <a href="../functions/sigsuspend.html"><i>sigsuspend</i>()</a> function should be used in preference to <i>sigpause</i>()
for broader portability.</p>
</blockquote>
<h4><a name="tag_03_686_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_686_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_686_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="xsh_chap02_04.html#tag_02_04"><i>Signal Concepts</i></a> , <a href="exec.html"><i><a href=
"../functions/exec.html">exec</a></i>()</a> , <a href="pause.html"><i>pause</i>()</a> , <a href=
"sigaction.html"><i>sigaction</i>()</a> , <a href="signal.html"><i>signal</i>()</a> , <a href=
"sigsuspend.html"><i>sigsuspend</i>()</a> , <a href="waitid.html"><i>waitid</i>()</a> , the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_686_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 4, Version 2.</p>
</blockquote>
<h4><a name="tag_03_686_12"></a>Issue 5</h4>
<blockquote>
<p>Moved from X/OPEN UNIX extension to BASE.</p>
<p>The DESCRIPTION is updated to indicate that the <i>sigpause</i>() function restores the process' signal mask to its original
state before returning.</p>
<p>The RETURN VALUE section is updated to indicate that the <i>sigpause</i>() function suspends execution of the process until a
signal is received, whereupon it returns -1 and sets <i>errno</i> to [EINTR].</p>
</blockquote>
<h4><a name="tag_03_686_13"></a>Issue 6</h4>
<blockquote>
<p>The DESCRIPTION is updated to avoid use of the term &quot;must&quot; for application requirements.</p>
<p>References to the <i>wait3</i>() function are removed.</p>
<p>The XSI functions are split out into their own reference page.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>