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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕永久在线不卡| 亚洲1区2区3区4区| 国产盗摄精品一区二区三区在线 | 成人性色生活片| 欧美高清在线一区| 99久久综合国产精品| 国产精品色哟哟网站| 成人h动漫精品一区二区| 日韩一区二区视频| 午夜视频久久久久久| 欧美日韩在线三区| 92精品国产成人观看免费| 欧美美女网站色| 美女视频第一区二区三区免费观看网站| 欧美一区二区三区四区视频| 精品一区二区三区欧美| 国产精品视频九色porn| 欧美四级电影在线观看| 日本午夜一本久久久综合| 日韩精品资源二区在线| 国产成人精品三级| 亚洲精品久久7777| 91精品一区二区三区久久久久久| 国内精品自线一区二区三区视频| 中文字幕av一区二区三区高| 在线观看av一区二区| 美女视频一区二区| 国产精品二区一区二区aⅴ污介绍| 91麻豆123| 另类小说图片综合网| 国产精品久久久爽爽爽麻豆色哟哟| 欧美在线观看视频在线| 精品中文字幕一区二区| 国产精品色哟哟网站| 欧美日本免费一区二区三区| 国产麻豆视频一区二区| 一区二区在线观看av| 欧美成人官网二区| 色噜噜狠狠成人中文综合| 精品一区二区三区香蕉蜜桃| 中文字幕一区二区三区乱码在线| 国产欧美日产一区| 韩国v欧美v日本v亚洲v| 日韩欧美一区二区免费| 奇米一区二区三区| 欧美探花视频资源| 手机精品视频在线观看| 欧美日韩一区久久| 午夜欧美一区二区三区在线播放| 色88888久久久久久影院按摩| 亚洲视频在线一区二区| 91久久一区二区| 一区二区三区丝袜| 欧美精品久久天天躁| 亚洲1区2区3区4区| 日韩网站在线看片你懂的| 久久国产精品99精品国产| 欧美在线影院一区二区| 国内精品在线播放| 在线播放91灌醉迷j高跟美女| 久久蜜桃一区二区| 国产成人精品aa毛片| 中文字幕av不卡| 国产精品久久久久久久裸模| 中文字幕在线免费不卡| 欧美在线影院一区二区| 日本aⅴ精品一区二区三区| 一区二区欧美在线观看| 国产精品丝袜一区| 欧美国产激情一区二区三区蜜月| 精品国产一区二区三区不卡| 91精品国产综合久久久久久久久久 | 高清不卡在线观看av| 午夜精品久久久久久久久久| 91精品国产色综合久久ai换脸| 国产精品系列在线播放| 亚洲欧美怡红院| 日韩精品中文字幕在线一区| 成人av影院在线| 久久97超碰国产精品超碰| 亚洲欧美在线视频| 日韩精品一区二区三区四区视频| 色婷婷久久99综合精品jk白丝| 成人激情免费电影网址| 日韩电影免费在线看| 67194成人在线观看| 久久99九九99精品| 亚洲激情中文1区| 狠狠色丁香婷婷综合久久片| 亚洲欧洲精品天堂一级 | 911国产精品| 国产乱理伦片在线观看夜一区| 国内精品久久久久影院薰衣草 | 国产精品久久毛片a| 日产精品久久久久久久性色| 精品一区二区三区视频| 一区二区三区中文字幕电影| 成人小视频免费观看| 亚洲专区一二三| 久久久精品影视| 欧美韩国日本综合| 亚洲免费观看在线视频| 国产精品欧美一级免费| 最新日韩av在线| 午夜私人影院久久久久| 男人的天堂久久精品| 日本午夜一本久久久综合| 久久精品免费观看| 国产一区二区三区在线观看免费视频 | 国产福利一区二区三区视频| 欧美日韩亚洲另类| 欧美视频你懂的| 日韩欧美亚洲国产精品字幕久久久| 欧美精品亚洲二区| 国产精品久久777777| 亚洲天堂av一区| 麻豆国产欧美一区二区三区| 成人国产精品视频| 4438x成人网最大色成网站| 日韩精品一区二区三区中文不卡 | 久久综合九色综合欧美亚洲| 日本一区二区三区在线不卡| 99久久精品国产网站| 欧美激情一区在线| 日本高清无吗v一区| 国产一区二区三区日韩| 国产精品三级电影| 精品婷婷伊人一区三区三| 欧美日韩国产一区| 欧美日韩大陆在线| 国产精品三级在线观看| 亚洲成人黄色影院| 日本韩国精品在线| 91在线视频官网| 日本不卡一区二区| 日本网站在线观看一区二区三区| 久久精品国产亚洲一区二区三区| 91网站视频在线观看| 欧美精品一区二区精品网| 亚洲一线二线三线视频| 欧美国产日韩在线观看| 毛片av一区二区三区| 成人少妇影院yyyy| 欧美精品久久久久久久久老牛影院| 国产精品私房写真福利视频| 蜜臀av国产精品久久久久| 色婷婷综合久久久中文一区二区| 国产午夜亚洲精品午夜鲁丝片| 亚洲成人动漫精品| 91免费小视频| 国产精品嫩草影院com| 九九在线精品视频| 日韩亚洲欧美高清| 一区二区不卡在线播放 | 国产精品99久久不卡二区| 91精品国产色综合久久ai换脸| 伊人色综合久久天天| av在线不卡网| 国产免费观看久久| 精品系列免费在线观看| 欧美一区二区在线免费播放| 亚洲电影激情视频网站| 亚洲女厕所小便bbb| 蜜臀av性久久久久蜜臀aⅴ流畅 | 在线播放中文字幕一区| 亚洲精品亚洲人成人网| 成人v精品蜜桃久久一区| 日本一区二区视频在线观看| 国产在线播放一区二区三区| 久久嫩草精品久久久精品一| 久久精品国产在热久久| 精品国产91九色蝌蚪| 美国十次了思思久久精品导航| 欧美丰满嫩嫩电影| 日韩精品一区第一页| 制服.丝袜.亚洲.中文.综合| 亚洲123区在线观看| av在线不卡电影| 亚洲免费观看高清在线观看| 日本精品一区二区三区高清| 亚洲综合另类小说| 欧美久久免费观看| 亚洲国产成人va在线观看天堂| 欧美久久一二区| 蜜臀av亚洲一区中文字幕| 精品sm捆绑视频| 成人小视频免费观看| 亚洲另类在线制服丝袜| 欧美影院精品一区| 三级欧美在线一区| 精品国产伦一区二区三区观看体验 | 国产麻豆91精品| 国产欧美一区二区精品仙草咪| 波多野结衣中文字幕一区| 亚洲欧美另类久久久精品2019| 欧美日韩高清一区二区| 精品午夜一区二区三区在线观看| 国产精品嫩草影院com| 欧美四级电影在线观看| 制服丝袜激情欧洲亚洲|