*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Linux man pages -> fork (2)              



NAME    [Toc]    [Back]

       fork - create a child process

SYNOPSIS    [Toc]    [Back]

       #include <sys/types.h>
       #include <unistd.h>

       pid_t fork(void);

DESCRIPTION    [Toc]    [Back]

       fork  creates a child process that differs from the parent process only
       in its PID and PPID, and in the fact that resource utilizations are set
       to 0.  File locks and pending signals are not inherited.

       Under Linux, fork is implemented using copy-on-write pages, so the only
       penalty incurred by fork is the time and memory required  to  duplicate
       the parent's page tables, and to create a unique task structure for the

RETURN VALUE    [Toc]    [Back]

       On success, the PID of the child process is returned  in  the  parent's
       thread  of execution, and a 0 is returned in the child's thread of execution.
	On failure, a -1 will be returned in the parent's context,  no
       child process will be created, and errno will be set appropriately.

ERRORS    [Toc]    [Back]

       EAGAIN fork cannot allocate sufficient memory to copy the parent's page
	      tables and allocate a task structure for the child.

       ENOMEM fork failed to allocate the necessary kernel structures  because
	      memory is tight.

CONFORMING TO    [Toc]    [Back]

       The fork call conforms to SVr4, SVID, POSIX, X/OPEN, BSD 4.3.

SEE ALSO    [Toc]    [Back]

       clone(2), execve(2), vfork(2), wait(2)

Linux 1.2.9			  1995-06-10			       FORK(2)
[ Back ]
 Similar pages
Name OS Title
vfork Linux create a child process and block parent
pthread_atfork Tru64 Declares fork handler routines to be called when the calling thread's process forks a child process
pxfwait IRIX Obtains information about a calling process' child process
times IRIX get process and child process times
times HP-UX get process and child process times
times Tru64 Get process and child process times
crtpipelin IRIX create one or more child processes, with I/O redirection
pxfwifstopped IRIX Determines if a child process has stopped
ptrace Tru64 Trace the execution of a child process
waitpid HP-UX wait for child process to stop or terminate
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service