亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? library_23.html

?? Glibc的中文手冊
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
<!-- This HTML file has been created by texi2html 1.27
     from library.texinfo on 3 March 1994 -->

<TITLE>The GNU C Library - Child Processes</TITLE>
<P>Go to the <A HREF="library_22.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_22.html">previous</A>, <A HREF="library_24.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html">next</A> section.<P>
<H1><A NAME="SEC401" HREF="library_toc.html#SEC401" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC401">Child Processes</A></H1>
<A NAME="IDX1680"></A>
<P>
<DFN>Processes</DFN> are the primitive units for allocation of system
resources.  Each process has its own address space and (usually) one
thread of control.  A process executes a program; you can have multiple
processes executing the same program, but each process has its own copy
of the program within its own address space and executes it
independently of the other copies.
<A NAME="IDX1681"></A>
<A NAME="IDX1682"></A>
<P>
Processes are organized hierarchically.  Each process has a <DFN>parent
process</DFN> which explicitly arranged to create it.  The processes created
by a given parent are called its <DFN>child processes</DFN>.  A child
inherits many of its attributes from the parent process.
<P>
This chapter describes how a program can create, terminate, and control
child processes.  Actually, there are three distinct operations
involved: creating a new child process, causing the new process to
execute a program, and coordinating the completion of the child process
with the original program.
<P>
The <CODE>system</CODE> function provides a simple, portable mechanism for
running another program; it does all three steps automatically.  If you
need more control over the details of how this is done, you can use the
primitive functions to do each step individually instead.
<P>
<A NAME="IDX1683"></A>
<H2><A NAME="SEC402" HREF="library_toc.html#SEC402" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC402">Running a Command</A></H2>
<P>
The easy way to run another program is to use the <CODE>system</CODE>
function.  This function does all the work of running a subprogram, but
it doesn't give you much control over the details: you have to wait
until the subprogram terminates before you can do anything else.
<P>
<A NAME="IDX1684"></A>
<A NAME="IDX1685"></A>
<U>Function:</U> int <B>system</B> <I>(const char *<VAR>command</VAR>)</I><P>
This function executes <VAR>command</VAR> as a shell command.  In the GNU C
library, it always uses the default shell <CODE>sh</CODE> to run the command.
In particular, it searches the directories in <CODE>PATH</CODE> to find
programs to execute.  The return value is <CODE>-1</CODE> if it wasn't
possible to create the shell process, and otherwise is the status of the
shell process.  See section <A HREF="library_23.html#SEC407" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC407">Process Completion</A>, for details on how this
status code can be interpreted.
<A NAME="IDX1686"></A>
<P>
The <CODE>system</CODE> function is declared in the header file
<TT>`stdlib.h'</TT>.
<P>
<STRONG>Portability Note:</STRONG> Some C implementations may not have any
notion of a command processor that can execute other programs.  You can
determine whether a command processor exists by executing
<CODE>system (NULL)</CODE>; if the return value is nonzero, a command
processor is available.
<P>
The <CODE>popen</CODE> and <CODE>pclose</CODE> functions (see section <A HREF="library_14.html#SEC213" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html#SEC213">Pipe to a Subprocess</A>) are closely related to the <CODE>system</CODE> function.  They
allow the parent process to communicate with the standard input and
output channels of the command being executed.
<P>
<H2><A NAME="SEC403" HREF="library_toc.html#SEC403" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC403">Process Creation Concepts</A></H2>
<P>
This section gives an overview of processes and of the steps involved in
creating a process and making it run another program.
<A NAME="IDX1687"></A>
<A NAME="IDX1688"></A>
<P>
Each process is named by a <DFN>process ID</DFN> number.  A unique process ID
is allocated to each process when it is created.  The <DFN>lifetime</DFN> of
a process ends when its termination is reported to its parent process;
at that time, all of the process resources, including its process ID,
are freed.
<A NAME="IDX1689"></A>
<A NAME="IDX1690"></A>
<A NAME="IDX1691"></A>
<A NAME="IDX1692"></A>
<P>
Processes are created with the <CODE>fork</CODE> system call (so the operation
of creating a new process is sometimes called <DFN>forking</DFN> a process).
The <DFN>child process</DFN> created by <CODE>fork</CODE> is an exact clone of the
original <DFN>parent process</DFN>, except that it has its own process ID.
<P>
After forking a child process, both the parent and child processes
continue to execute normally.  If you want your program to wait for a
child process to finish executing before continuing, you must do this
explicitly after the fork operation, by calling <CODE>wait</CODE> or
<CODE>waitpid</CODE> (see section <A HREF="library_23.html#SEC407" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC407">Process Completion</A>).  These functions give you
limited information about why the child terminated--for example, its
exit status code.
<P>
A newly forked child process continues to execute the same program as
its parent process, at the point where the <CODE>fork</CODE> call returns.
You can use the return value from <CODE>fork</CODE> to tell whether the program
is running in the parent process or the child.
<A NAME="IDX1693"></A>
<P>
Having several processes run the same program is only occasionally
useful.  But the child can execute another program using one of the
<CODE>exec</CODE> functions; see section <A HREF="library_23.html#SEC406" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC406">Executing a File</A>.  The program that the
process is executing is called its <DFN>process image</DFN>.  Starting
execution of a new program causes the process to forget all about its
previous process image; when the new program exits, the process exits
too, instead of returning to the previous process image.
<P>
<H2><A NAME="SEC404" HREF="library_toc.html#SEC404" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC404">Process Identification</A></H2>
<P>
The <CODE>pid_t</CODE> data type represents process IDs.  You can get the
process ID of a process by calling <CODE>getpid</CODE>.  The function
<CODE>getppid</CODE> returns the process ID of the parent of the current
process (this is also known as the <DFN>parent process ID</DFN>).  Your
program should include the header files <TT>`unistd.h'</TT> and
<TT>`sys/types.h'</TT> to use these functions.
<A NAME="IDX1695"></A>
<A NAME="IDX1694"></A>
<P>
<A NAME="IDX1696"></A>
<U>Data Type:</U> <B>pid_t</B><P>
The <CODE>pid_t</CODE> data type is a signed integer type which is capable
of representing a process ID.  In the GNU library, this is an <CODE>int</CODE>.
<P>
<A NAME="IDX1697"></A>
<U>Function:</U> pid_t <B>getpid</B> <I>(void)</I><P>
The <CODE>getpid</CODE> function returns the process ID of the current process.
<P>
<A NAME="IDX1698"></A>
<U>Function:</U> pid_t <B>getppid</B> <I>(void)</I><P>
The <CODE>getppid</CODE> function returns the process ID of the parent of the
current process.
<P>
<H2><A NAME="SEC405" HREF="library_toc.html#SEC405" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC405">Creating a Process</A></H2>
<P>
The <CODE>fork</CODE> function is the primitive for creating a process.
It is declared in the header file <TT>`unistd.h'</TT>.
<A NAME="IDX1699"></A>
<P>
<A NAME="IDX1700"></A>
<U>Function:</U> pid_t <B>fork</B> <I>(void)</I><P>
The <CODE>fork</CODE> function creates a new process.
<P>
If the operation is successful, there are then both parent and child
processes and both see <CODE>fork</CODE> return, but with different values: it
returns a value of <CODE>0</CODE> in the child process and returns the child's
process ID in the parent process.
<P>
If process creation failed, <CODE>fork</CODE> returns a value of <CODE>-1</CODE> in
the parent process.  The following <CODE>errno</CODE> error conditions are
defined for <CODE>fork</CODE>:
<P>
<DL COMPACT>
<DT><CODE>EAGAIN</CODE>
<DD>There aren't enough system resources to create another process, or the
user already has too many processes running.
<P>
<DT><CODE>ENOMEM</CODE>
<DD>The process requires more space than the system can supply.
</DL>
<P>
The specific attributes of the child process that differ from the
parent process are:
<P>
<UL>
<LI>
The child process has its own unique process ID.
<P>
<LI>
The parent process ID of the child process is the process ID of its
parent process.
<P>
<LI>
The child process gets its own copies of the parent process's open file
descriptors.  Subsequently changing attributes of the file descriptors
in the parent process won't affect the file descriptors in the child,
and vice versa.  See section <A HREF="library_12.html#SEC181" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC181">Control Operations on Files</A>.
<P>
<LI>
The elapsed processor times for the child process are set to zero;
see section <A HREF="library_19.html#SEC310" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC310">Processor Time</A>.
<P>
<LI>
The child doesn't inherit file locks set by the parent process.
See section <A HREF="library_12.html#SEC181" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC181">Control Operations on Files</A>.
<P>
<LI>
The child doesn't inherit alarms set by the parent process.
See section <A HREF="library_19.html#SEC321" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC321">Setting an Alarm</A>.
<P>
<LI>
The set of pending signals (see section <A HREF="library_21.html#SEC334" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC334">How Signals Are Delivered</A>) for the child
process is cleared.  (The child process inherits its mask of blocked
signals and signal actions from the parent process.)
</UL>
<P>
<A NAME="IDX1701"></A>
<U>Function:</U> pid_t <B>vfork</B> <I>(void)</I><P>
The <CODE>vfork</CODE> function is similar to <CODE>fork</CODE> but more efficient;
however, there are restrictions you must follow to use it safely.
<P>
While <CODE>fork</CODE> makes a complete copy of the calling process's address
space and allows both the parent and child to execute independently,
<CODE>vfork</CODE> does not make this copy.  Instead, the child process
created with <CODE>vfork</CODE> shares its parent's address space until it calls
one of the <CODE>exec</CODE> functions.  In the meantime, the parent process
suspends execution.
<P>
You must be very careful not to allow the child process created with
<CODE>vfork</CODE> to modify any global data or even local variables shared
with the parent.  Furthermore, the child process cannot return from (or
do a long jump out of) the function that called <CODE>vfork</CODE>!  This
would leave the parent process's control information very confused.  If
in doubt, use <CODE>fork</CODE> instead.
<P>
Some operating systems don't really implement <CODE>vfork</CODE>.  The GNU C
library permits you to use <CODE>vfork</CODE> on all systems, but actually
executes <CODE>fork</CODE> if <CODE>vfork</CODE> isn't available.  If you follow
the proper precautions for using <CODE>vfork</CODE>, your program will still
work even if the system uses <CODE>fork</CODE> instead.
<P>
<A NAME="IDX1702"></A>
<A NAME="IDX1703"></A>
<H2><A NAME="SEC406" HREF="library_toc.html#SEC406" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC406">Executing a File</A></H2>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av在线播放不卡| 成人黄色大片在线观看| 欧美一区二区三区视频在线观看 | 午夜精品久久久久久久蜜桃app| 99re这里只有精品6| 亚洲丝袜另类动漫二区| 欧美在线三级电影| 日韩激情一二三区| 精品88久久久久88久久久| 国产精品一区不卡| 自拍视频在线观看一区二区| 欧美午夜免费电影| 美女久久久精品| 国产视频911| 欧美三级蜜桃2在线观看| 久久国产免费看| 亚洲欧洲99久久| 欧美日韩高清不卡| 国产乱码字幕精品高清av | 亚洲人被黑人高潮完整版| 91福利在线播放| 奇米888四色在线精品| 久久网这里都是精品| 成人高清视频在线| 无吗不卡中文字幕| 欧美极品少妇xxxxⅹ高跟鞋| 欧美影院一区二区| 国产精品自拍三区| 亚洲午夜免费视频| 欧美激情在线观看视频免费| 欧美日韩高清一区| 成人在线视频一区二区| 亚洲mv大片欧洲mv大片精品| 久久久www成人免费无遮挡大片| 91麻豆免费观看| 老鸭窝一区二区久久精品| 国产精品欧美精品| 欧美成人a视频| 在线亚洲高清视频| 风间由美性色一区二区三区| 天堂精品中文字幕在线| 国产精品久久久久久久浪潮网站 | 91国偷自产一区二区开放时间| 日韩制服丝袜先锋影音| 综合中文字幕亚洲| 久久综合九色综合97婷婷| 欧美性色欧美a在线播放| 国产精品12区| 久88久久88久久久| 日韩精品每日更新| 亚洲福利视频一区| 亚洲美女偷拍久久| 欧美韩日一区二区三区| 精品少妇一区二区三区免费观看 | 欧美一区二区三区啪啪| 91在线视频官网| 国产精品一区二区果冻传媒| 青青草成人在线观看| 午夜欧美视频在线观看| 亚洲欧美偷拍卡通变态| 国产欧美1区2区3区| 精品国产乱码久久久久久久久| 欧美中文字幕一区二区三区亚洲| 成人国产精品免费| 成人h版在线观看| 懂色av一区二区三区免费观看 | 国产成人在线观看免费网站| 日本女优在线视频一区二区| 亚洲亚洲人成综合网络| 亚洲精品免费播放| 亚洲欧美一区二区三区久本道91| 国产精品午夜电影| 国产精品久久久久影院亚瑟| 国产精品五月天| ...av二区三区久久精品| **性色生活片久久毛片| 亚洲啪啪综合av一区二区三区| 亚洲欧洲日韩av| 亚洲欧美区自拍先锋| 亚洲免费观看高清| 亚洲制服欧美中文字幕中文字幕| 一区二区三区产品免费精品久久75| 亚洲人成在线播放网站岛国| 亚洲你懂的在线视频| 一区在线播放视频| 亚洲一区自拍偷拍| 石原莉奈在线亚洲二区| 青草国产精品久久久久久| 精东粉嫩av免费一区二区三区| 国产在线国偷精品免费看| 国产精品一卡二卡| 99久久久久免费精品国产| 色综合久久九月婷婷色综合| 91精品福利视频| 在线电影一区二区三区| 日韩一区二区三区电影在线观看 | 日韩激情一二三区| 国产一区二区三区免费看| 99国产精品国产精品久久| a美女胸又www黄视频久久| 欧美亚洲另类激情小说| 欧美一区二区三区日韩| 久久久噜噜噜久久中文字幕色伊伊| 国产视频一区二区在线观看| 亚洲日本在线观看| 日本欧洲一区二区| 国产成人午夜视频| 91精品办公室少妇高潮对白| 欧美一区在线视频| 欧美经典一区二区三区| 一区二区三区国产| 国产综合色在线视频区| 91在线国产观看| 欧美一区二区在线不卡| 国产欧美日韩综合精品一区二区| 亚洲欧洲精品成人久久奇米网| 亚洲一二三区不卡| 国产91在线观看| 欧美人与禽zozo性伦| 国产午夜精品福利| 亚洲高清在线视频| 成人激情免费电影网址| 欧美日本一区二区在线观看| 久久蜜桃av一区精品变态类天堂| 亚洲免费在线观看| 精品在线免费视频| 欧美最新大片在线看| 欧美韩国日本一区| 毛片一区二区三区| 91精彩视频在线| 国产精品久久久久久久久久久免费看 | 国产一区二区主播在线| 欧美性三三影院| 国产精品久久久久久久久免费丝袜| 亚洲成人黄色影院| 99精品视频免费在线观看| 欧美精品一区二区三区高清aⅴ| 亚洲综合一二区| 成人精品小蝌蚪| 久久婷婷国产综合国色天香 | 国产精品国产三级国产aⅴ入口 | 国内精品久久久久影院薰衣草| 91久久线看在观草草青青| 中文字幕av一区二区三区高| 日韩和欧美一区二区三区| 在线精品视频免费观看| 亚洲天堂2014| 高清日韩电视剧大全免费| 欧美大片在线观看一区| 五月婷婷综合激情| 91成人在线观看喷潮| 中文字幕一区三区| 国产超碰在线一区| 久久久久亚洲蜜桃| 国内外成人在线视频| 欧美高清视频一二三区| 亚洲电影第三页| 欧洲国产伦久久久久久久| 日韩美女视频一区二区 | 99re视频这里只有精品| 亚洲国产日韩一区二区| 99国产精品久久久久久久久久 | 91激情五月电影| 亚洲精品写真福利| 91麻豆精品秘密| 亚洲免费在线看| 一本大道久久a久久精二百| 亚洲天堂2016| 91久久精品国产91性色tv| 亚洲激情中文1区| 色狠狠综合天天综合综合| 亚洲精品视频在线观看免费 | 天堂成人免费av电影一区| 欧美日韩一区二区三区视频| 亚洲一区二区三区四区在线 | 国模冰冰炮一区二区| 久久综合九色综合97婷婷女人| 国产一区二区三区免费观看| 久久久国产精品不卡| jiyouzz国产精品久久| 国产精品久久久久久久久动漫| av中文一区二区三区| 亚洲免费观看视频| 欧美精品123区| 国产呦萝稀缺另类资源| 国产亚洲成aⅴ人片在线观看| 成人免费三级在线| 亚洲一区二区三区影院| 日韩午夜av一区| 国产精品自拍av| 亚洲欧洲日韩在线| 在线电影欧美成精品| 韩国精品主播一区二区在线观看 | 婷婷久久综合九色综合伊人色| 欧美一级淫片007| 成人午夜在线免费| 亚洲综合久久av| 欧美精品一区二区在线播放| 成人手机电影网| 亚洲第一主播视频|