DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fork(S-osr5)


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-osr5), exec(S-osr5), getitimer(S-osr5), nice(S-osr5), plock(S-osr5), ptrace(S-osr5), semop(S-osr5), setgid(S-osr5), setgroups(S-osr5), setluid(S-osr5), setuid(S-osr5), shmop(S-osr5), sigaction(S-osr5), signal(M), signal(S-osr5), sigset(S-osr5), times(S-osr5), ulimit(S-osr5), umask(S-osr5), wait(S-osr5)

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 .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005