diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-25 05:13:22 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-07-25 05:13:22 +0000 |
commit | 65c318b95179c222675601130a9b5b2b0f3e0cb6 (patch) | |
tree | 8312fa7c30f810a4a087808bd8180b12f559bf35 /lib | |
parent | a41726c2d0c6bbf317a6b7646908f6a472348993 (diff) |
update to reality from netbsd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/vfork.2 | 61 |
1 files changed, 15 insertions, 46 deletions
diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2 index 55e184b2954..e363e74fc7e 100644 --- a/lib/libc/sys/vfork.2 +++ b/lib/libc/sys/vfork.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: vfork.2,v 1.6 1995/02/27 12:39:30 cgd Exp $ +.\" $NetBSD: vfork.2,v 1.8 1997/07/10 07:54:13 mikel Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,66 +33,42 @@ .\" .\" @(#)vfork.2 8.1 (Berkeley) 6/4/93 .\" -.Dd June 4, 1993 +.Dd June 30, 1997 .Dt VFORK 2 .Os BSD 4 .Sh NAME .Nm vfork -.Nd spawn new process in a virtual memory efficient way +.Nd spawn new process and block parent .Sh SYNOPSIS .Fd #include <unistd.h> .Ft pid_t .Fn vfork void .Sh DESCRIPTION .Fn Vfork -can be used to create new processes without fully copying the address +was originally 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 +environment. It was useful when the purpose of .Xr fork 2 would have been to create a new system context for an -.Xr execve 2 . +.Xr execve . +It is the case that +.Xr fork +is now efficient, even in the above case, so that the need for +.Fn vfork +is diminished. .Fn Vfork differs from -.Xr fork 2 -in that the child borrows the parent's memory and thread of -control until a call to +.Xr fork +in that the parent is suspended until the child makes a call to .Xr execve 2 or an exit (either by a call to -.Xr exit 2 +.Xr _exit 2 or abnormally.) -The parent process is suspended while the child is using its resources. .Pp .Fn Vfork returns 0 in the child's context and (later) the pid of the child in the parent's context. -.Pp -.Fn Vfork -can normally be used just like -.Xr fork 2 . -It does not work, however, to return while running in the childs context -from the procedure that called -.Fn vfork -since the eventual return from -.Fn vfork -would then return to a no longer existent stack frame. -Be careful, also, to call -.Xr _exit 2 -rather than -.Xr exit 3 -if you can't -.Xr execve 2 , -since -.Xr exit 3 -will flush and close standard I/O channels, and thereby mess up the -parent processes standard I/O data structures. -(Even with -.Xr fork 2 -it is wrong to call -.Xr exit 3 -since buffered data would then be flushed twice.) .Sh SEE ALSO -.Xr _exit 2 , -.Xr exit 3 , .Xr fork 2 , .Xr execve 2 , .Xr sigaction 2 , @@ -101,13 +77,6 @@ since buffered data would then be flushed twice.) Same as for .Xr fork 2 . .Sh BUGS -This system call will be eliminated when proper system sharing -mechanisms are implemented. -Users should not depend on the memory -sharing semantics of -.Xr vfork 2 -as it will, in that case, be made synonymous to -.Xr fork 2 . .Pp To avoid a possible deadlock situation, processes that are children in the middle @@ -127,4 +96,4 @@ and input attempts result in an end-of-file indication. The .Fn vfork function call appeared in -.Bx 3.0 . +.Bx 2.9 . |