]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/vfork.2
Start of man-pages-5.03: renaming .Announce and .lsm files
[thirdparty/man-pages.git] / man2 / vfork.2
index b4ac02c4823685b0fe34a1cb41cb6792b94d75d1..eddce6a5a979987b1983cc86b307a6bf0ca0452d 100644 (file)
 .\" 1999-11-10: Merged text taken from the page contributed by
 .\" Reed H. Petty (rhp@draper.net)
 .\"
-.TH VFORK 2 2016-03-15 "Linux" "Linux Programmer's Manual"
+.TH VFORK 2 2017-09-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 vfork \- create a child process and block parent
 .SH SYNOPSIS
 .B #include <sys/types.h>
 .br
 .B #include <unistd.h>
-.sp
+.PP
 .B pid_t vfork(void);
-.sp
+.PP
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .in
-.sp
+.PP
 .BR vfork ():
 .ad l
 .RS 4
@@ -109,10 +109,13 @@ or it makes a call to
 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
-.BR exit (3),
-but may call
+.BR exit (3)
+(which would have the effect of calling exit handlers
+established by the parent process and flushing the parent's
+.BR stdio (3)
+buffers), but may call
 .BR _exit (2).
-
+.PP
 As with
 .BR fork (2),
 the child process created by
@@ -123,7 +126,7 @@ the
 .BR vfork ()
 call differs only in the treatment of the virtual address space,
 as described above.
-
+.PP
 Signals sent to the parent
 arrive after the child releases the parent's memory
 (i.e., after the child terminates
@@ -160,7 +163,7 @@ held in a register.
 4.3BSD; POSIX.1-2001 (but marked OBSOLETE).
 POSIX.1-2008 removes the specification of
 .BR vfork ().
-
+.PP
 The requirements put on
 .BR vfork ()
 by the standards are weaker than those put on
@@ -225,7 +228,7 @@ By contrast, using
 .BR fork (2)
 in this scenario requires either committing an amount of memory equal
 to the size of the parent process (if strict overcommitting is in force)
-or overcommiting memory with the risk that a process is terminated
+or overcommitting memory with the risk that a process is terminated
 by the out-of-memory (OOM) killer.
 .\"
 .SS Caveats
@@ -239,7 +242,7 @@ changes memory, those changes may result in an inconsistent process state
 from the perspective of the parent process
 (e.g., memory changes would be visible in the parent,
 but changes to the state of open file descriptors would not be visible).
-
+.PP
 When
 .BR vfork ()
 is called in a multithreaded process,
@@ -276,7 +279,7 @@ LinuxThreads threading library.
 (See
 .BR pthreads (7)
 for a description of Linux threading libraries.)
-
+.PP
 A call to
 .BR vfork ()
 is equivalent to calling
@@ -284,7 +287,7 @@ is equivalent to calling
 with
 .I flags
 specified as:
-
+.PP
      CLONE_VM | CLONE_VFORK | SIGCHLD
 .SS History
 The
@@ -294,8 +297,8 @@ system call appeared in 3.0BSD.
 .\" present, but definitely on its way out'.
 In 4.4BSD it was made synonymous to
 .BR fork (2)
-but NetBSD introduced it again,
-cf.
+but NetBSD introduced it again;
+see
 .UR http://www.netbsd.org\:/Documentation\:/kernel\:/vfork.html
 .UE .
 In Linux, it has been equivalent to
@@ -328,6 +331,7 @@ are allowed and input attempts result in an end-of-file indication."
 .SH SEE ALSO
 .BR clone (2),
 .BR execve (2),
+.BR _exit (2),
 .BR fork (2),
 .BR unshare (2),
 .BR wait (2)