Forking, vforking or rforking are the only ways new processes are created.
selects which resources of the
invoking process (parent) are shared
by the new process (child) or initialized to
their default values.
The resources include
the open file descriptor table (which, when shared, permits processes
to open and close files for other processes),
and open files.
or the logical OR of some subset of:
If set a new process is created; otherwise changes affect the
If set, the child process will be dissociated from the parent.
exit the child will not leave a status for the parent to collect.
If set, the invoker's file descriptor table (see
is copied; otherwise the two processes share a
If set, the new process starts with a clean file descriptor table.
Is mutually exclusive with
If set, the new process shares file descriptor to process leaders table
with its parent.
Only applies when neither
If set, the kernel will force sharing of the entire address space,
typically by sharing the hardware page table directly.
will thus inherit and share all the segments the parent process owns,
whether they are normally shareable or not.
The stack segment is
not split (both the parent and child return on the same stack) and thus
with the RFMEM flag may not generally be called directly from high level
languages including C.
May be set only with
A helper function is provided to assist with this problem and will cause
the new process to run on the provided stack.
Note that a lot of code will not run correctly in such an environment.
If set, the kernel will force sharing the sigacts structure between the
child and the parent.
If set, the kernel will deliver a specified signal to the parent
upon the child exit, instead of default SIGCHLD.
The signal number
is specified by oring the
Specifying signal number 0 disables signal delivery upon the child exit.
If set, the kernel will deliver SIGUSR1 instead of SIGCHLD upon thread
exit for the child.
This is intended to mimic certain Linux clone behaviour.
File descriptors in a shared file descriptor table are kept
open until either they are explicitly closed
or all processes sharing the table exit.
semantics but reset all signal actions in the child to default.
This flag is used by the
implementation in libc.
is set, the
value returned in the parent process
is the process id
of the child process; the value returned in the child is zero.
the return value is zero.
Process id's range from 1 to the maximum integer
will sleep, if necessary, until required process resources are available.
can be implemented as a call to
rfork(RFFDG | RFPROC)
but is not for backwards compatibility.