|RFORK(2)||System Calls Manual||RFORK(2)|
rfork()) create new processes. The new process (child process) is an exact copy of the calling process (parent process), except as outlined in the fork(2) manual page.
rfork() is used to manipulate the resources of the parent process and the child process.
Operations currently supported include whether to copy or share
the file descriptor table between the two processes, whether to share the
address space, and whether the parent should
wait(2) for the child process
rfork() takes a single argument,
flags, which controls which of these resources should
be manipulated. They are defined in the header file
⟨sys/param.h⟩ and are the logical OR
of one or more of the following:
RFMEM. Automatically enables
RFNOWAIT. The kern.rthreads sysctl must be enabled for this to succeed.
fork(2) can be
implemented as a call to
"RFFDG|RFPROC", but isn't for backwards compatibility. If a
process has file descriptor table sharing active, setuid or setgid programs
will not execve(2) with extra
rfork() will fail and no child process will be created if:
MAXUPRCon the total number of processes under execution by a single user would be exceeded.
MAXUPRCis currently defined in ⟨sys/param.h⟩ as
CHILD_MAX, which is currently defined as 80 in ⟨sys/syslimits.h⟩.
RFTHREADflag was set but the kern.rthreads sysctl was not enabled.
rfork() function first appeared in Plan 9.
RFTHREADcannot be used from C, as the two threads would return on the same stack.
|June 29, 2010||OpenBSD-5.1|