📄 waitid.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 ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_010_446"> </a>NAME</h4><blockquote>waitid - wait for a child process to change state</blockquote><h4><a name = "tag_000_010_447"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="syswait.h.html">sys/wait.h</a>>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"> </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"> </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"> </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"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_452"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_453"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_454"> </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"><sys/wait.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 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 + -