*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: fork1 | Section: 9 | Source: OpenBSD | File: fork1.9
FORK1(9) FreeBSD Kernel Developer's Manual FORK1(9) NAME fork1 - create a new process SYNOPSIS #include <sys/types.h> #include <sys/proc.h> int fork1(struct proc *p1, int flags, void (*func)(void *), void *arg, register_t *retval, struct proc **rnewprocp); DESCRIPTION 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: FORK_FORK The call is done by the fork(2) system call. Used only for statistics. FORK_VFORK The call is done by the vfork(2) system call. Used only for statistics. FORK_PPWAIT Suspend the parent process until the child is terminated (by calling _exit(2) or abnormally), or makes a call to execve(2). FORK_SHAREFILES Let the child share the file descriptor table with the parent through fdshare(). The default behavior is to copy the table through fdcopy(). FORK_IDLE The new thread will be left in the SIDL state. The default behavior is to make it runnable and add it to the run queue. FORK_NOZOMBIE The child will be dissociated from the parent and will not leave a status for the parent to collect. See wait(2). FORK_SHAREVM The child will share the parent's address space. The default behavior is that the child gets a copy-on-write copy of the address space. FORK_SYSTEM The child will be marked as a system process. FORK_PTRACE The child will start with tracing enabled, as if ptrace(PT_TRACE_ME, 0, 0, 0) had been invoked in the child. The new thread will begin execution by calling func, which must not be NULL. If arg is not NULL, it is passed as the argument to func. Otherwise, a pointer to the new process's only thread is passed. 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. RETURN VALUES Upon successful completion of the fork operation, fork1() returns 0. Otherwise, the following error values are returned: [EAGAIN] The system limits on the total number of threads or processes would be exceeded. [EAGAIN] The limit RLIMIT_NPROC on the total number of processes under execution by this user id would be exceeded. [ENOMEM] There is insufficient swap space for the new thread. SEE ALSO execve(2), fork(2), vfork(2), kthread_create(9), psignal(9), tfind(9) CAVEATS The fork1 function semantics are specific to OpenBSD. Other BSD systems have different semantics. FreeBSD 14.1-RELEASE-p8 December 29, 2022 FreeBSD 14.1-RELEASE-p8

Navigation Options