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

📄 waitid.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>waitid</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_010_446">&nbsp;</a>NAME</h4><blockquote>waitid - wait for a child process to change state</blockquote><h4><a name = "tag_000_010_447">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="syswait.h.html">sys/wait.h</a>&gt;int waitid(idtype_t <i>idtype</i>, id_t <i>id</i>, siginfo_t *<i>infop</i>, int <i>options</i>);</code></pre></blockquote><h4><a name = "tag_000_010_448">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>waitid()</i>function suspends the calling thread until one child of the process containing the calling thread changes state.  It records the current state of a child in the structure pointed to by<i>infop</i>.  If a child process changed state prior to the call to<i>waitid()</i>,<i>waitid()</i>returns immediately.If more than one thread is suspended in <i><a href="wait.html">wait()</a></i>or<i><a href="waitpid.html">waitpid()</a></i>waiting termination of the same process, exactly one thread will return the process status at the time of the target process termination<p>The <i>idtype</i> and <i>id</i> arguments are used to specify which children<i>waitid()</i>will wait for.<p>If <i>idtype</i> is P_PID,<i>waitid()</i>will wait for the child with a process ID equal to (<b>pid_t</b>)<i>id</i>.<p>If <i>idtype</i> is P_PGID,<i>waitid()</i>will wait for any child with a process group ID equal to (<b>pid_t</b>)<i>id</i>.<p>If <i>idtype</i> is P_ALL,<i>waitid()</i>will wait for any children and <i>id</i> is ignored.<p>The <i>options</i> argument is used to specify which state changes<i>waitid()</i>will wait for.  It is formed by OR-ing together one or more of the followingflags:<dl compact><dt>WEXITED<dd>Wait for processes that have exited.<dt>WSTOPPED<dd>Status will be returned for any child that has stopped upon receipt of asignal.<dt>WCONTINUED<dd>Status will be returned for any child that was stopped and has been continued.<dt>WNOHANG<dd>Return immediately if there are no children to wait for.<dt>WNOWAIT<dd>Keep the process whose status is returned in <i>infop</i> in a waitable state.This will not affect the state of the process; the process may be waited foragain after this call completes.</dl><p>The <i>infop</i> argument must point to a <b>siginfo_t</b> structure.  If<i>waitid()</i>returns because a child process was found that satisfied the conditionsindicated by the arguments <i>idtype</i> and <i>options</i>, then the structurepointed to by <i>infop</i> will be filled in by the system with the status ofthe process.  The <b>si_signo</b> member will always be equal to SIGCHLD.</blockquote><h4><a name = "tag_000_010_449">&nbsp;</a>RETURN VALUE</h4><blockquote>If<i>waitid()</i>returns due to the change of state of one of its children, 0 is returned.Otherwise, -1 is returned and <i>errno</i> is set to indicate the error.</blockquote><h4><a name = "tag_000_010_450">&nbsp;</a>ERRORS</h4><blockquote>The<i>waitid()</i>function will fail if:<dl compact><dt>[ECHILD]<dd>The calling process has no existing unwaited-for child processes.<dt>[EINTR]<dd>The<i>waitid()</i>function was interrupted by a signal.<dt>[EINVAL]<dd>An invalid value was specified for <i>options</i>, or<i>idtype</i> and <i>id</i> specify an invalid set of processes.</dl><br></blockquote><h4><a name = "tag_000_010_451">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_452">&nbsp;</a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_453">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_454">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="exec.html">exec</a></i>,<i><a href="exit.html">exit()</a></i>,<i><a href="wait.html">wait()</a></i>,<i><a href="syswait.h.html">&lt;sys/wait.h&gt;</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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