]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vfork.2
ip.7: tfix
[thirdparty/man-pages.git] / man2 / vfork.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1999 Andries Brouwer (aeb@cwi.nl), 1 Nov 1999
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" 1999-11-10: Merged text taken from the page contributed by
26.\" Reed H. Petty (rhp@draper.net)
27.\"
97986708 28.TH VFORK 2 2016-03-15 "Linux" "Linux Programmer's Manual"
fea681da
MK
29.SH NAME
30vfork \- create a child process and block parent
31.SH SYNOPSIS
32.B #include <sys/types.h>
33.br
34.B #include <unistd.h>
35.sp
36.B pid_t vfork(void);
cc4615cc
MK
37.sp
38.in -4n
39Feature Test Macro Requirements for glibc (see
40.BR feature_test_macros (7)):
41.in
42.sp
43.BR vfork ():
2df50e3d
MK
44.ad l
45.RS 4
46.PD 0
47.TP 4
48Since glibc 2.12:
49.nf
f8619b6a
MK
50(_XOPEN_SOURCE\ >=\ 500) && ! (_POSIX_C_SOURCE\ >=\ 200809L)
51 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
52 || /* Glibc versions <= 2.19: */ _BSD_SOURCE
2df50e3d
MK
53.TP 4
54.fi
55Before glibc 2.12:
cf7fa0a1
MK
56_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
57.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
2df50e3d
MK
58.PD
59.RE
60.ad b
8c87824d 61.SH DESCRIPTION
73d8cece 62.SS Standard description
f9f81237 63(From POSIX.1)
fea681da 64The
bed66765 65.BR vfork ()
fea681da 66function has the same effect as
0bfa087b 67.BR fork (2),
d9bfdb9c 68except that the behavior is undefined if the process created by
bed66765 69.BR vfork ()
c13182ef
MK
70either modifies any data other than a variable of type
71.I pid_t
70cbdedf 72used to store the return value from
bed66765 73.BR vfork (),
fea681da 74or returns from the function in which
bed66765 75.BR vfork ()
fea681da 76was called, or calls any other function before successfully calling
0bfa087b 77.BR _exit (2)
fea681da 78or one of the
d806e103 79.BR exec (3)
fea681da 80family of functions.
73d8cece 81.SS Linux description
bed66765 82.BR vfork (),
fea681da
MK
83just like
84.BR fork (2),
85creates a child process of the calling process.
86For details and return value and errors, see
87.BR fork (2).
88.PP
bed66765 89.BR vfork ()
fea681da
MK
90is a special case of
91.BR clone (2).
92It is used to create new processes without copying the page tables of
c13182ef 93the parent process.
600c9aa9 94It may be useful in performance-sensitive applications