📄 47.html
字号:
<html>
<head>
<title>include/sys/wait.h</title>
<meta name='robots' content='noindex,nofollow'>
<meta name='generator' content='GLOBAL-5.4.1'>
</head>
<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
<a name='TOP'><h2><a href='../mains.html'>root</a>/<a href='../files/99.html'>include</a>/<a href='../files/102.html'>sys</a>/wait.h</h2>
<i><font color='green'>/* [<][>][^][v][top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
<hr>
<h2><a href='../J/47.html' title='Multiple included from 2 places.'>INCLUDED FROM</a></h2>
<hr>
<pre>
<a name='L1'><font color='darkred'>#ifndef</font> <a href='../S/47.html#L2' title='Defined at 2 in include/sys/wait.h.'>_SYS_WAIT_H</a>
<a name='L2'><font color='darkred'>#define</font> <a href='../S/47.html#L1' title='Refered from 1 in include/sys/wait.h.'>_SYS_WAIT_H</a>
<a name='L3'>
<a name='L4'><font color='darkred'>#include</font> <<a href='45.html'>sys/types.h</a>>
<a name='L5'>
<a name='L6'><font color='darkred'>#define</font> _LOW(v) ( (v) & 0377) <i><font color='green'>// 取低字节(8 进制表示)。</font></i>
<a name='L7'><font color='darkred'>#define</font> _HIGH(v) ( ((v) >> 8) & 0377) <i><font color='green'>// 取高字节。</font></i>
<a name='L8'>
<a name='L9'><i><font color='green'>/* options for waitpid, WUNTRACED not supported */</font></i>
<a name='L10'><i><font color='green'>/* waitpid 的选项,其中WUNTRACED 未被支持 */</font></i>
<a name='L11'><font color='darkred'>#define</font> <a href='../S/67.html#L254' title='Refered from 254 in kernel/exit.c.'>WNOHANG</a> 1 <i><font color='green'>// 如果没有状态也不要挂起,并立刻返回。</font></i>
<a name='L12'><font color='darkred'>#define</font> <a href='../S/67.html#L235' title='Refered from 235 in kernel/exit.c.'>WUNTRACED</a> 2 <i><font color='green'>// 报告停止执行的子进程状态。</font></i>
<a name='L13'>
<a name='L14'><font color='darkred'>#define</font> WIFEXITED(s) (!((s)&0xFF) <i><font color='green'>// 如果子进程正常退出,则为真。</font></i>
<a name='L15'><font color='darkred'>#define</font> WIFSTOPPED(s) (((s)&0xFF)==0x7F) <i><font color='green'>// 如果子进程正停止着,则为true。</font></i>
<a name='L16'><font color='darkred'>#define</font> WEXITSTATUS(s) (((s)>>8)&0xFF) <i><font color='green'>// 返回退出状态。</font></i>
<a name='L17'><font color='darkred'>#define</font> WTERMSIG(s) ((s)&0x7F) <i><font color='green'>// 返回导致进程终止的信号值(信号量)。</font></i>
<a name='L18'><font color='darkred'>#define</font> WSTOPSIG(s) (((s)>>8)&0xFF) <i><font color='green'>// 返回导致进程停止的信号值。</font></i>
<a name='L19'><font color='darkred'>#define</font> WIFSIGNALED(s) (((<b>unsigned</b> <b>int</b>)(s)-1 & 0xFFFF) < 0xFF) <i><font color='green'>// 如果由于未捕捉到信号</font></i>
<a name='L20'><i><font color='green'>// 而导致子进程退出则为真。</font></i>
<a name='L21'>
<a name='L22'><i><font color='green'>// wait()和waitpit()函数允许进程获取与其子进程之一的状态信息。各种选项允许获取已经终止或</font></i>
<a name='L23'><i><font color='green'>// 停止的子进程状态信息。如果存在两个或两个以上子进程的状态信息,则报告的顺序是不指定的。</font></i>
<a name='L24'><i><font color='green'>// wait()将挂起当前进程,直到其子进程之一退出(终止),或者收到要求终止该进程的信号,</font></i>
<a name='L25'><i><font color='green'>// 或者是需要调用一个信号句柄(信号处理程序)。</font></i>
<a name='L26'><i><font color='green'>// waitpid()挂起当前进程,直到pid 指定的子进程退出(终止)或者收到要求终止该进程的信号,</font></i>
<a name='L27'><i><font color='green'>// 或者是需要调用一个信号句柄(信号处理程序)。</font></i>
<a name='L28'><i><font color='green'>// 如果pid= -1,options=0,则waitpid()的作用与wait()函数一样。否则其行为将随pid 和options</font></i>
<a name='L29'><i><font color='green'>// 参数的不同而不同。(参见kernel/exit.c,142)</font></i>
<a name='L30'><a href='../S/45.html#L23' title='Defined at 23 in include/sys/types.h.'>pid_t</a> wait (<b>int</b> *stat_loc);
<a name='L31'><a href='../S/45.html#L23' title='Defined at 23 in include/sys/types.h.'>pid_t</a> waitpid (<a href='../S/45.html#L23' title='Defined at 23 in include/sys/types.h.'>pid_t</a> pid, <b>int</b> *stat_loc, <b>int</b> options);
<a name='L32'>
<a name='L33'><font color='darkred'>#endif</font>
</pre>
<hr>
<a name='BOTTOM'>
<i><font color='green'>/* [<][>][^][v]<a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -