FORK(2) DOMAIN/IX SYS5 FORK(2)
NAME
fork - create a new process
USAGE
int fork()
DESCRIPTION
Fork causes a new process to be created. The new, or child,
process is an exact copy of the calling, or parent, process.
The child process inherits the following attributes from the
parent process:
environment
close-on-exec flag (see exec(2))
signal handling settings (i.e., SIG_DFL, SIG_IGN, func-
tion address)
set-user-ID mode bit
set-group-ID mode bit
nice value (see nice(2))
all attached shared memory segments (see shmop(2))
process group ID
tty group ID (see exit(2) and signal(2))
time left until an alarm clock signal (see alarm(2))
current working directory
root directory
file mode creation mask (see umask(2))
The child process differs from the parent process in the
following ways:
The child process has a unique process ID.
The child process has a different parent process ID
(i.e., the child's parent is not the parent's parent).
The child process has its own copy of the parent's file
descriptors. Each of the child's file descriptors
shares a common file pointer with the corresponding
file descriptor of the parent.
All semadj values are cleared (see semop(2)).
Process locks, text locks and data locks are not inher-
ited by the child (see plock(2)).
The child process's utime, stime, cutime, and cstime
are set to zero. The time left until an alarm clock
signal is reset to zero.
Printed 12/4/86 FORK-1
FORK(2) DOMAIN/IX SYS5 FORK(2)
NOTES
On DOMAIN systems, fork may produce unexpected or undesired
results when called from an mbx server process, or form a
process using gpr or gpio.
RETURN VALUE
Upon successful completion, fork returns a value of zero to
the child process and returns the process ID of the child
process to the parent process. Otherwise, it returns -1 to
the parent process, no child process is created, and errno
is set to indicate the error.
ERRORS
Fork fails and no child process is created if one or more of
the following is true:
[EAGAIN] The system-imposed limit on the total number of
processes under execution would be exceeded.
[EAGAIN] The system-imposed limit on the total number of
processes under execution by a single user would
be exceeded.
RELATED INFORMATION
exec(2), nice(2), plock(2), semop(2), shmop(2), signal(2),
times(2), umask(2), wait(2)
FORK-2 Printed 12/4/86