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

📄 fork.2

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 2
字号:
.\" SCCSID: @(#)fork.2	8.1	9/11/90.TH fork 2.SH Namefork \- create a new process.SH Syntax.nf.B #include <sys/types.h>.B #include <unistd.h>.PP.B pid = fork().B pid_t pid;.fi.SH Description.NXR "fork system call".NXR "process" "creating"The.PN forksystem call causes creation of a new process.The new process (child process) is an exact copy of thecalling process except for the following:.IP \(bu 5The child process has a unique process ID..IP \(bu 5The child process has a different parent process ID (that is,the process ID of the parent process)..IP \(bu 5The child process has its own copy of the parent's descriptors.These descriptors reference the same underlying objects, so that,for instance, file pointers in file objects are shared betweenthe child and the parent, so that a .MS lseek 2on a descriptor in the child process can affect a subsequent.I reador.I writeby the parent.This descriptor copying is also used by the shell toestablish standard input and output for newly created processesas well as to set up pipes..IP \(bu 5The child processes resource utilizations are set to 0.For further information, see .MS setrlimit 2 ..SH Return ValuesUpon successful completion, .PN forkreturns a valueof 0 to the child process and returns the process ID of the childprocess to the parent process.  Otherwise, a value of \-1 is returnedto the parent process, no child process is created, and the globalvariable \fIerrno\fP is set to indicate the error..SH DiagnosticsThe.PN forksystem callfails and no child process are created under the following conditions:.TP 15[EAGAIN]The system-imposed limit {PROC_MAX} on the totalnumber of processes under execution would be exceeded..TP 15[EAGAIN]The system-imposed limit {CHILD_MAX} on the total number ofprocesses under execution by a single user would be exceeded..TP 15[ENOMEM]There is insufficient swap space for the new process..SH See Alsoexecve(2), wait(2)

⌨️ 快捷键说明

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