|FORK1(9)||Kernel Developer's Manual||FORK1(9)|
fork1(struct proc *p1,
int flags, void (*func)(void *),
void *arg, register_t *retval,
struct proc **rnewprocp);
fork1() creates a new process out of p1, which should be the current thread. This function is used primarily to implement the fork(2) and vfork(2) system calls, as well as the kthread_create(9) function.
The flags argument is used to control the behavior of the fork and is created by a bitwise-OR of the following values:
fdshare(). The default behavior is to copy the table through
SIDLstate. The default behavior is to make it runnable and add it to the run queue.
sigactsshare(). The default behavior is to copy the signal actions from the parent with
FORK_SHAREVMmust also be set.
If func is not
the new thread will begin execution by calling this function. It defaults to
child_return, which returns to userland.
If arg is not
it is the argument to the previous function. It defaults to a pointer to the
If retval is not
NULL, the PID of the child process will be stored in
*retval on successful completion.
If rnewprocp is not
NULL, the newly created thread is stored in
*rnewprocp on successful completion.
fork1() returns 0. Otherwise, the following error values are returned:
RLIMIT_NPROCon the total number of processes under execution by this user id would be exceeded.
fork1function semantics are specific to OpenBSD. Other BSD systems have different semantics.
|June 11, 2017||OpenBSD-current|