2 .\" This manual page is taken directly from Plan9, and modified to
3 .\" describe the actual BSD implementation. Permission for
4 .\" use of this page comes from Rob Pike <rob@plan9.att.com>.
13 .Nd manipulate process resources
21 Forking, vforking or rforking are the only ways new processes are created.
26 selects which resources of the
27 invoking process (parent) are shared
28 by the new process (child) or initialized to
31 the open file descriptor table (which, when shared, permits processes
32 to open and close files for other processes),
39 or the logical OR of some subset of:
40 .Bl -tag -width ".Dv RFLINUXTHPN"
42 If set a new process is created; otherwise changes affect the
45 If set, the child process will be dissociated from the parent.
47 exit the child will not leave a status for the parent to collect.
51 If set, the invoker's file descriptor table (see
53 is copied; otherwise the two processes share a
56 If set, the new process starts with a clean file descriptor table.
57 Is mutually exclusive with
60 If set, the new process shares file descriptor to process leaders table
62 Only applies when neither
68 If set, the kernel will force sharing of the entire address space,
69 typically by sharing the hardware page table directly.
71 will thus inherit and share all the segments the parent process owns,
72 whether they are normally shareable or not.
74 not split (both the parent and child return on the same stack) and thus
76 with the RFMEM flag may not generally be called directly from high level
77 languages including C.
80 A helper function is provided to assist with this problem and will cause
81 the new process to run on the provided stack.
85 Note that a lot of code will not run correctly in such an environment.
87 If set, the kernel will force sharing the sigacts structure between the
90 If set, the kernel will deliver a specified signal to the parent
91 upon the child exit, instead of default SIGCHLD.
94 is specified by oring the
95 .Dv RFTSIGFLAGS(signum)
98 Specifying signal number 0 disables signal delivery upon the child exit.
100 If set, the kernel will deliver SIGUSR1 instead of SIGCHLD upon thread
102 This is intended to mimic certain Linux clone behaviour.
105 File descriptors in a shared file descriptor table are kept
106 open until either they are explicitly closed
107 or all processes sharing the table exit.
115 semantics but reset all signal actions in the child to default.
116 This flag is used by the
118 implementation in libc.
123 value returned in the parent process
125 of the child process; the value returned in the child is zero.
128 the return value is zero.
129 Process id's range from 1 to the maximum integer
135 will sleep, if necessary, until required process resources are available.
140 can be implemented as a call to
141 .Fn rfork "RFFDG | RFPROC"
142 but is not for backwards compatibility.
144 Upon successful completion,
147 of 0 to the child process and returns the process ID of the child
148 process to the parent process.
149 Otherwise, a value of -1 is returned
150 to the parent process, no child process is created, and the global
153 is set to indicate the error.
158 will fail and no child process will be created if:
161 The system-imposed limit on the total
162 number of processes under execution would be exceeded.
163 The limit is given by the
167 (The limit is actually ten less than this
168 except for the super user).
170 The user is not the super user, and
171 the system-imposed limit
172 on the total number of
173 processes under execution by a single user would be exceeded.
174 The limit is given by the
177 .Dv KERN_MAXPROCPERUID .
179 The user is not the super user, and
180 the soft resource limit corresponding to the
184 would be exceeded (see
187 Both the RFFDG and the RFCFDG flags were specified.
189 Any flags not listed above were specified.
191 An invalid signal number was specified.
193 There is insufficient swap space for the new process.
200 .Xr pthread_create 3 ,
205 function first appeared in Plan9.