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

📄 syscalls_71.html

📁 Linux系统调用
💻 HTML
字号:
<!-- This HTML file has been created by texi2html 1.29
     from syscalls.texi on 4 June 1994 -->

<TITLE>Syscall specifications of Linux - wait4</TITLE>
<P>Go to the <A HREF="syscalls_70.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_70.html">previous</A>, <A HREF="syscalls_72.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_72.html">next</A> section.<P>
<H2><A NAME="SEC71" HREF="syscalls_toc.html#SEC71" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC71">wait4</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>pid_t wait4(pid_t <VAR>pid</VAR>, int *<VAR>status</VAR>, int <VAR>options</VAR>,
struct rusage *<VAR>rusage</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>pid</VAR>: [in] the pid of the child.
<P>
<VAR>status</VAR>: [out] the return status of the child.
<P>
<VAR>options</VAR>: [in] options for the wait.
<P>
<VAR>rusage</VAR>: [out] the ressource usage of the dead child.
<P>
<H3>DESCRIPTION</H3>
<P>
This call puts the calling task to sleep until the child specified by
<VAR>pid</VAR> exits or a signal is caught. If a child that fits the request
is already in a zombie state at the time of the call, the zombie is
exorcised and the call retrurns immediately.
<P>
<VAR>pid</VAR> has different meanings according to the ranges of values it
may take:
<P>
<DL COMPACT>
<DT><CODE>&#60;-1</CODE>
<DD>waits for the exit of any child with a process group id of -<VAR>pid</VAR>.
<P>
<DT><CODE>-1</CODE>
<DD>wait for any child to exit.
<P>
<DT><CODE>0</CODE>
<DD>wait for the exit of any child with a process group id equal to the one
of the current task.
<P>
<DT><CODE>&#62;0</CODE>
<DD>wait for the child with pid equals to <VAR>pid</VAR> to exit.
</DL>
<P>
If <VAR>status</VAR> is not <CODE>NULL</CODE>, then the return status of the child
is stored to the area pointed to by <VAR>status</VAR>.
<P>
<VAR>options</VAR> is one or more of the following values or'ed together:
<P>
<DL COMPACT>
<DT><CODE>WNOHANG</CODE>
<DD>do not wait for a process to exit.
<P>
<DT><CODE>WUNTRACED</CODE>
<DD>also return for children who are stopped.
</DL>
<P>
<H3>RETURN VALUE</H3>
<P>
The pid of the child who exited. If <CODE>WNOHANG</CODE> has been specified,
then the call may return zero. In case of error, the call returns zero
and <CODE>errno</CODE> is set to one of the following values:
<P>
<UL>
<LI><CODE>ECHILD</CODE>: the child does not exist.
<LI><CODE>EPERM</CODE>: the effective uid of the calling task is not equal
to the one of the child the task is waiting for and the calling task
does not have superuser privileges.
<LI><CODE>ERESTARTSYS</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_70.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_70.html">previous</A>, <A HREF="syscalls_72.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_72.html">next</A> section.<P>

⌨️ 快捷键说明

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