⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sigqueue.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 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-2003 The Open Group, All Rights Reserved --><title>sigqueue</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="sigqueue"></a> <a name="tag_03_695"></a><!-- sigqueue --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_695_01"></a>NAME</h4><blockquote>sigqueue - queue a signal to a process (<b>REALTIME</b>)</blockquote><h4><a name="tag_03_695_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('RTS')">RTS</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 sigqueue(pid_t</tt> <i>pid</i><tt>, int</tt> <i>signo</i><tt>, const union sigval</tt> <i>value</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_695_03"></a>DESCRIPTION</h4><blockquote><p>The <i>sigqueue</i>() function shall cause the signal specified by <i>signo</i> to be sent with the value specified by<i>value</i> to the process specified by <i>pid</i>. If <i>signo</i> is zero (the null signal), error checking is performed but nosignal is actually sent. The null signal can be used to check the validity of <i>pid</i>.</p><p>The conditions required for a process to have permission to queue a signal to another process are the same as for the <a href="../functions/kill.html"><i>kill</i>()</a> function.</p><p>The <i>sigqueue</i>() function shall return immediately. If SA_SIGINFO is set for <i>signo</i> and if the resources wereavailable to queue the signal, the signal shall be queued and sent to the receiving process. If SA_SIGINFO is not set for<i>signo</i>, then <i>signo</i> shall be sent at least once to the receiving process; it is unspecified whether <i>value</i> shallbe sent to the receiving process as a result of this call.</p><p>If the value of <i>pid</i> causes <i>signo</i> to be generated for the sending process, and if <i>signo</i> is not blocked forthe calling thread and if no other thread has <i>signo</i> unblocked or is waiting in a <a href="../functions/sigwait.html"><i>sigwait</i>()</a> function for <i>signo</i>, either <i>signo</i> or at least the pending, unblockedsignal shall be delivered to the calling thread before the <i>sigqueue</i>() function returns. Should any multiple pending signalsin the range SIGRTMIN to SIGRTMAX be selected for delivery, it shall be the lowest numbered one. The selection order betweenrealtime and non-realtime signals, or between multiple pending non-realtime signals, is unspecified.</p></blockquote><h4><a name="tag_03_695_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, the specified signal shall have been queued, and the <i>sigqueue</i>() function shall return a valueof zero. Otherwise, the function shall return a value of -1 and set <i>errno</i> to indicate the error.</p></blockquote><h4><a name="tag_03_695_05"></a>ERRORS</h4><blockquote><p>The <i>sigqueue</i>() function shall fail if:</p><dl compact><dt>[EAGAIN]</dt><dd>No resources are available to queue the signal. The process has already queued {SIGQUEUE_MAX} signals that are still pending atthe receiver(s), or a system-wide resource limit has been exceeded.</dd><dt>[EINVAL]</dt><dd>The value of the <i>signo</i> argument is an invalid or unsupported signal number.</dd><dt>[EPERM]</dt><dd>The process does not have the appropriate privilege to send the signal to the receiving process.</dd><dt>[ESRCH]</dt><dd>The process <i>pid</i> does not exist.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_695_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_695_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_695_08"></a>RATIONALE</h4><blockquote><p>The <i>sigqueue</i>() function allows an application to queue a realtime signal to itself or to another process, specifying theapplication-defined value. This is common practice in realtime applications on existing realtime systems. It was felt thatspecifying another function in the <i>sig</i>... name space already carved out for signals was preferable to extending theinterface to <a href="../functions/kill.html"><i>kill</i>()</a>.</p><p>Such a function became necessary when the put/get event function of the message queues was removed. It should be noted that the<i>sigqueue</i>() function implies reduced performance in a security-conscious implementation as the access permissions between thesender and receiver have to be checked on each send when the <i>pid</i> is resolved into a target process. Such access checks werenecessary only at message queue open in the previous interface.</p><p>The standard developers required that <i>sigqueue</i>() have the same semantics with respect to the null signal as <a href="../functions/kill.html"><i>kill</i>()</a>, and that the same permission checking be used. But because of the difficulty ofimplementing the &quot;broadcast&quot; semantic of <a href="../functions/kill.html"><i>kill</i>()</a> (for example, to process groups) andthe interaction with resource allocation, this semantic was not adopted. The <i>sigqueue</i>() function queues a signal to a singleprocess specified by the <i>pid</i> argument.</p><p>The <i>sigqueue</i>() function can fail if the system has insufficient resources to queue the signal. An explicit limit on thenumber of queued signals that a process could send was introduced. While the limit is &quot;per-sender&quot;, this volume ofIEEE&nbsp;Std&nbsp;1003.1-2001 does not specify that the resources be part of the state of the sender. This would require eitherthat the sender be maintained after exit until all signals that it had sent to other processes were handled or that all suchsignals that had not yet been acted upon be removed from the queue(s) of the receivers. This volume ofIEEE&nbsp;Std&nbsp;1003.1-2001 does not preclude this behavior, but an implementation that allocated queuing resources from asystem-wide pool (with per-sender limits) and that leaves queued signals pending after the sender exits is also permitted.</p></blockquote><h4><a name="tag_03_695_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_695_10"></a>SEE ALSO</h4><blockquote><p><a href="xsh_chap02_08.html#tag_02_08_01"><i>Realtime Signals</i></a> , the Base Definitions volume ofIEEE&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_695_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension and the POSIX Threads Extension.</p></blockquote><h4><a name="tag_03_695_12"></a>Issue 6</h4><blockquote><p>The <i>sigqueue</i>() function is marked as part of the Realtime Signals Extension option.</p><p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the RealtimeSignals Extension option.</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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -