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

📄 waitid.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>waitid</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="waitid"></a> <a name="tag_03_823"></a><!-- waitid --> <!--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_823_01"></a>NAME</h4><blockquote>waitid - wait for a child process to change state</blockquote><h4><a name="tag_03_823_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/sys/wait.h.html">sys/wait.h</a>&gt;<br><br> int waitid(idtype_t</tt> <i>idtype</i><tt>, id_t</tt> <i>id</i><tt>, siginfo_t *</tt><i>infop</i><tt>, int</tt><i>options</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_823_03"></a>DESCRIPTION</h4><blockquote><p>The <i>waitid</i>() function shall suspend the calling thread until one child of the process containing the calling threadchanges state. It records the current state of a child in the structure pointed to by <i>infop</i>. If a child process changedstate prior to the call to <i>waitid</i>(), <i>waitid</i>() shall return immediately. If more than one thread is suspended in <ahref="../functions/wait.html"><i>wait</i>()</a> or <a href="../functions/waitpid.html"><i>waitpid</i>()</a> waiting for terminationof the same process, exactly one thread shall return the process status at the time of the target process termination.</p><p>The <i>idtype</i> and <i>id</i> arguments are used to specify which children <i>waitid</i>() waits for.</p><p>If <i>idtype</i> is P_PID, <i>waitid</i>() shall wait for the child with a process ID equal to (<b>pid_t</b>)<i>id</i>.</p><p>If <i>idtype</i> is P_PGID, <i>waitid</i>() shall wait for any child with a process group ID equal to(<b>pid_t</b>)<i>id</i>.</p><p>If <i>idtype</i> is P_ALL, <i>waitid</i>() shall wait for any children and <i>id</i> is ignored.</p><p>The <i>options</i> argument is used to specify which state changes <i>waitid</i>() shall wait for. It is formed by OR'ingtogether one or more of the following flags:</p><dl compact><dt>WEXITED</dt><dd>Wait for processes that have exited.</dd><dt>WSTOPPED</dt><dd>Status shall be returned for any child that has stopped upon receipt of a signal.</dd><dt>WCONTINUED</dt><dd>Status shall be returned for any child that was stopped and has been continued.</dd><dt>WNOHANG</dt><dd>Return immediately if there are no children to wait for.</dd><dt>WNOWAIT</dt><dd>Keep the process whose status is returned in <i>infop</i> in a waitable state. This shall not affect the state of the process;the process may be waited for again after this call completes.</dd></dl><p>The application shall ensure that the <i>infop</i> argument points to a <b>siginfo_t</b> structure. If <i>waitid</i>() returnsbecause a child process was found that satisfied the conditions indicated by the arguments <i>idtype</i> and <i>options</i>, thenthe structure pointed to by <i>infop</i> shall be filled in by the system with the status of the process. The <i>si_signo</i>member shall always be equal to SIGCHLD.</p></blockquote><h4><a name="tag_03_823_04"></a>RETURN VALUE</h4><blockquote><p>If WNOHANG was specified and there are no children to wait for, 0 shall be returned. If <i>waitid</i>() returns due to thechange of state of one of its children, 0 shall be returned. Otherwise, -1 shall be returned and <i>errno</i> set to indicate theerror.</p></blockquote><h4><a name="tag_03_823_05"></a>ERRORS</h4><blockquote><p>The <i>waitid</i>() function shall fail if:</p><dl compact><dt>[ECHILD]</dt><dd>The calling process has no existing unwaited-for child processes.</dd><dt>[EINTR]</dt><dd>The <i>waitid</i>() function was interrupted by a signal.</dd><dt>[EINVAL]</dt><dd>An invalid value was specified for <i>options</i>, or <i>idtype</i> and <i>id</i> specify an invalid set of processes.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_823_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_823_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_823_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_823_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_823_10"></a>SEE ALSO</h4><blockquote><p><a href="exec.html"><i><a href="../functions/exec.html">exec</a></i>()</a> , <a href="exit.html"><i>exit</i>()</a> , <a href="wait.html"><i>wait</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/wait.h.html"><i>&lt;sys/wait.h&gt;</i></a></p></blockquote><h4><a name="tag_03_823_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4, Version 2.</p></blockquote><h4><a name="tag_03_823_12"></a>Issue 5</h4><blockquote><p>Moved from X/OPEN UNIX extension to BASE.</p><p>The DESCRIPTION is updated for alignment with the POSIX Threads Extension.</p></blockquote><h4><a name="tag_03_823_13"></a>Issue 6</h4><blockquote><p>The DESCRIPTION is updated to avoid use of the term &quot;must&quot; for application requirements.</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 + -