summaryrefslogtreecommitdiff
path: root/static/openbsd/man2/vfork.2
diff options
context:
space:
mode:
Diffstat (limited to 'static/openbsd/man2/vfork.2')
-rw-r--r--static/openbsd/man2/vfork.2107
1 files changed, 107 insertions, 0 deletions
diff --git a/static/openbsd/man2/vfork.2 b/static/openbsd/man2/vfork.2
new file mode 100644
index 00000000..a9e819ac
--- /dev/null
+++ b/static/openbsd/man2/vfork.2
@@ -0,0 +1,107 @@
+.\" $OpenBSD: vfork.2,v 1.20 2015/09/10 17:55:21 schwarze 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.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)vfork.2 8.1 (Berkeley) 6/4/93
+.\"
+.Dd $Mdocdate: September 10 2015 $
+.Dt VFORK 2
+.Os
+.Sh NAME
+.Nm vfork
+.Nd spawn new process and block parent
+.Sh SYNOPSIS
+.In unistd.h
+.Ft pid_t
+.Fn vfork void
+.Sh DESCRIPTION
+.Fn vfork
+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 was useful when the purpose of
+.Xr fork 2
+would have been to create a new system context for an
+.Xr execve 2 .
+Since
+.Xr fork 2
+is now efficient, even in the above case, the need for
+.Fn vfork
+has diminished.
+.Fn vfork
+differs from
+.Xr fork 2
+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
+or abnormally).
+In addition, fork handlers established using
+.Xr pthread_atfork 3
+are not called when a multithreaded program calls
+.Fn vfork .
+.Pp
+.Fn vfork
+returns 0 in the child's context and (later) the PID of the child in
+the parent's context.
+.Sh RETURN VALUES
+Same as for
+.Xr fork 2 .
+.Sh SEE ALSO
+.Xr execve 2 ,
+.Xr fork 2 ,
+.Xr sigaction 2 ,
+.Xr wait 2
+.Sh HISTORY
+The
+.Fn vfork
+function call appeared in
+.Bx 3.0
+with the additional semantics that the child process ran in the
+memory of the parent until it called
+.Xr execve 2
+or exited.
+That sharing of memory was removed in
+.Bx 4.4 ,
+leaving just the semantics of blocking the parent until the child calls
+.Xr execve 2
+or exits.
+On many other systems the original behavior has been restored,
+making this interface particularly unportable.
+.Sh BUGS
+To avoid a possible deadlock situation, processes that are children
+in the middle of a
+.Fn vfork
+are never sent
+.Dv SIGTTOU
+or
+.Dv SIGTTIN
+signals; rather, output or
+.Xr ioctl 2
+calls are allowed and input attempts result in an end-of-file indication.