.\" describe the actual OpenBSD implimentation. Permission for
.\" use of this page comes from Rob Pike <rob@plan9.att.com>.
.\"
-.TH FORK 2
+.TH RFORK 2
.SH NAME
-fork, rfork \- manipulate process resources
+rfork \- manipulate process resources
.SH SYNOPSIS
-.B #include <u.h>
+.B #include <sys/param.h>
.br
-.B #include <libc.h>
+.B #include <unistd.h>
.PP
.nf
.B
-int fork(void)
-.PP
-.B
int rfork(int flags)
.fi
.SH DESCRIPTION
-Forking is the only way new processes are created.
+Forking or rforking is the only way new processes are created.
The
.I flags
argument to
by the new process (child) or initialized to
their default values.
The resources include
-the file name space,
the open file descriptor table (which, when shared, permits processes
to open and close files for other processes),
-the set of environment variables
-(see
-.IR env (3)),
-the note group
-(the set of processes that receive notes written to a member's
-.B notepg
-file; see
-.IR proc (3)),
and open files.
.I Flags
is the logical OR of some subset of
.B RFPROC
If set a new process is created; otherwise changes affect the
current process.
+The current implementation requires this flag to always be set.
.TP
.B RFNOWAIT
If set, the child process will be dissociated from the parent. Upon
(see
.IR wait (2))
for the parent to collect.
+This is not currently implemented.
.TP
-.B RFNAMEG
-If set, the new process inherits a copy of the parent's name space;
-otherwise the new process shares the parent's name space.
-The tag space for
-.IR rendezvous (2)
-is considered part of the name space.
-Is mutually exclusive with
-.BR RFCNAMEG .
-.TP
-.B RFCNAMEG
-If set, the new process starts with a clean name space. A new
-name space must be built from a mount of an open file descriptor.
-Is mutually exclusive with
-.BR RFNAMEG .
-.TP
-.B RFENVG
-If set, the environment variables are copied;
-otherwise the two processes share environment variables.
-Is mutually exclusive with
-.BR RFCENVG .
-.TP
-.B RFCENVG
-If set, the new process starts with an empty environment.
-Is mutually exclusive with
-.BR RFENVG .
-.TP
-.B RFNOTEG
-Each process is a member of a group of processes that all
-receive notes when a note is written to any of their
-.B notepg
-files (see
-.IR proc (3)).
-The group of a new process is by default the same as its parent, but if
-.B RFNOTEG
-is set (regardless of
-.BR RFPROC ),
-the process becomes the first in a new group, isolated from
-previous processes.
+.B RFNAMEG, RFCNAMEG, RFENVG, RFCENVG, RFNOTEG
+These are Plan 9 specific flags, and not implimented.
.TP
.B RFFDG
If set, the invoker's file descriptor table (see
.BR RFFDG .
.TP
.B RFMEM
-If set, the kernel will mark segments of type
-.B data
-and
-.B bss
-as shared. The child
+If set, the kernel will force sharing of the entire address space.
+The child
will then inherit all the shared segments the parent process owns. Other segment
types will be unaffected. Subsequent forks by the parent will then
propagate the shared data and bss between children. The stack segment
will sleep, if necessary, until required process resources are available.
.PP
.I Fork
-is just a call of
-.BR rfork(RFFDG|RFPROC) .
-.SH SOURCE
-.B /sys/src/libc/9syscall
-.br
-.B /sys/src/libc/9sys/fork.c
+can be implemented as a call to
+.BR rfork(RFFDG|RFPROC)
+but isn't for backwards compatibility.
.SH SEE ALSO
.IR intro (2),
-.IR proc (3),
-.SH DIAGNOSTICS
-These functions set
-.IR errstr .
+.IR fork (2),
+.IR minherit (2).