X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..0a7de7458d150b5d4dffc935ba399be265ef0a1a:/bsd/man/man2/vfork.2 diff --git a/bsd/man/man2/vfork.2 b/bsd/man/man2/vfork.2 index 06e201dfc..3a07e9965 100644 --- a/bsd/man/man2/vfork.2 +++ b/bsd/man/man2/vfork.2 @@ -42,16 +42,18 @@ .Sh SYNOPSIS .Fd #include .Ft pid_t -.Fn vfork void +.Fo vfork +.Fa void +.Fc .Sh DESCRIPTION -.Fn Vfork +.Fn vfork can be used to create new processes without fully copying the address space of the old process, which is horrendously inefficient in a paged environment. It is useful when the purpose of .Xr fork 2 would have been to create a new system context for an .Xr execve . -.Fn Vfork +.Fn vfork differs from .Xr fork in that the child borrows the parent's memory and thread of @@ -62,11 +64,11 @@ or an exit (either by a call to or abnormally.) The parent process is suspended while the child is using its resources. .Pp -.Fn Vfork +.Fn vfork returns 0 in the child's context and (later) the pid of the child in the parent's context. .Pp -.Fn Vfork +.Fn vfork can normally be used just like .Xr fork . It does not work, however, to return while running in the childs context @@ -91,13 +93,30 @@ it is wrong to call .Xr exit since buffered data would then be flushed twice.) .Sh SEE ALSO -.Xr fork 2 , .Xr execve 2 , +.Xr fork 2 , .Xr sigaction 2 , -.Xr wait 2 , -.Sh DIAGNOSTICS -Same as for -.Xr fork . +.Xr wait 2 +.Sh ERRORS +The +.Fn vfork +system call will fail for any of the reasons described +in the +.Xr fork +man page. +In addition, it will fail if: +.Bl -tag -width Er +.\" =========== +.It Bq Er EINVAL +A system call other than +.Xr _exit() +or +.Xr execve() +(or libc functions that make no system calls other than those) +is called following calling a +.Fn vfork +call. +.El .Sh BUGS This system call will be eliminated when proper system sharing mechanisms are implemented.