vfork.2: Child holds parent's memory until execve() or *termination*

The page was phrased in a few places to describe the child as
holding the parent's memory until the child does an execve(2)
or an _exit(2).  The latter case should really be the more
general process termimation (i.e., either _exit(2) or abnormal
termination).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reported-by: Valdis.Kletnieks@vt.edu
This commit is contained in:
Michael Kerrisk 2008-10-30 08:12:12 -05:00
parent dd68f56461
commit a18e24a14a
1 changed files with 15 additions and 16 deletions

View File

@ -23,7 +23,7 @@
.\" 1999-11-10: Merged text taken from the page contributed by .\" 1999-11-10: Merged text taken from the page contributed by
.\" Reed H. Petty (rhp@draper.net) .\" Reed H. Petty (rhp@draper.net)
.\" .\"
.TH VFORK 2 2008-10-29 "Linux" "Linux Programmer's Manual" .TH VFORK 2 2008-10-30 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
vfork \- create a child process and block parent vfork \- create a child process and block parent
.SH SYNOPSIS .SH SYNOPSIS
@ -80,13 +80,15 @@ where a child will be created which then immediately issues an
.BR vfork () .BR vfork ()
differs from differs from
.BR fork (2) .BR fork (2)
in that the parent is suspended until the child makes a call to in that the parent is suspended until the child terminates
.BR execve (2) (either normally,
or by calling
.BR _exit (2). .BR exit (2),
The child shares all memory with its parent, including the stack, until or abnormally, after delivery of a fatal signal),
.BR execve (2) or it makes a call to
is issued by the child. .BR execve (2).
Until that point, the child shares all memory with its parent,
including the stack.
The child must not return from the current function or call The child must not return from the current function or call
.BR exit (3), .BR exit (3),
but may call but may call
@ -95,9 +97,8 @@ but may call
Signal handlers are inherited, but not shared. Signal handlers are inherited, but not shared.
Signals to the parent Signals to the parent
arrive after the child releases the parent's memory arrive after the child releases the parent's memory
(i.e., after the child calls (i.e., after the child terminates
.BR _exit (2) or calls
or
.BR execve (2)). .BR execve (2)).
.SS "Historic Description" .SS "Historic Description"
Under Linux, Under Linux,
@ -135,11 +136,9 @@ The requirements put on
by the standards are weaker than those put on by the standards are weaker than those put on
.BR fork (2), .BR fork (2),
so an implementation where the two are synonymous is compliant. so an implementation where the two are synonymous is compliant.
In particular, the programmer cannot In particular, the programmer cannot rely on the parent
rely on the parent remaining blocked until a call of remaining blocked until the child either terminates or calls
.BR execve (2) .BR execve (2),
or
.BR _exit (2)
and cannot rely on any specific behavior with respect to shared memory. and cannot rely on any specific behavior with respect to shared memory.
.\" In AIXv3.1 vfork is equivalent to fork. .\" In AIXv3.1 vfork is equivalent to fork.
.SH NOTES .SH NOTES