From dc98f535781f603ed55a2c0775d3a9c797056f19 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 10 Jan 1996 17:10:05 +0000 Subject: describe actual openbsd rfork() details. this should be converted to a mandoc manpage by some brave individual (prettier because they fit more data on the same page). please? --- lib/libc/sys/rfork.2 | 86 ++++++++++------------------------------------------ 1 file changed, 16 insertions(+), 70 deletions(-) (limited to 'lib/libc/sys/rfork.2') diff --git a/lib/libc/sys/rfork.2 b/lib/libc/sys/rfork.2 index e81e03d9692..0e4ad63486a 100644 --- a/lib/libc/sys/rfork.2 +++ b/lib/libc/sys/rfork.2 @@ -3,23 +3,20 @@ .\" describe the actual OpenBSD implimentation. Permission for .\" use of this page comes from Rob Pike . .\" -.TH FORK 2 +.TH RFORK 2 .SH NAME -fork, rfork \- manipulate process resources +rfork \- manipulate process resources .SH SYNOPSIS -.B #include +.B #include .br -.B #include +.B #include .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 @@ -29,17 +26,8 @@ invoking process (parent) are shared 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 @@ -48,6 +36,7 @@ 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 @@ -56,45 +45,10 @@ exit the child will leave no (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 @@ -108,11 +62,8 @@ Is mutually exclusive with .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 @@ -140,16 +91,11 @@ value. 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). -- cgit v1.2.3