DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

fork(S)


fork -- create a new process

Syntax

cc . . . -lc

int fork ()

Description

The fork system call creates a new process. The new process (child process) is an exact copy of the calling process (parent process). The child process inherits the following attributes from the parent process: The child process differs from the parent process in the following ways:

The fork system call fails and no child process is created if one or more of the following is true:


[EAGAIN]

[EMFILE]
The shared data table would overflow.

[ENOMEM]
The process requires more space than the system can supply.

See also

alarm(S), exec(S), getitimer(S), nice(S), plock(S), ptrace(S), semop(S), setgid(S), setgroups(S), setluid(S), setuid(S), shmop(S), sigaction(S), signal(M), signal(S), sigset(S), times(S), ulimit(S), umask(S), wait(S)

Diagnostics

Upon successful completion, fork returns a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process; no child process is created, and errno is set to indicate the error.

Standards conformance

fork is conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003