]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vfork.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[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.\"
608bf950 28.TH VFORK 2 2012-08-05 "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
50_BSD_SOURCE ||
98dbe7af 51 (_XOPEN_SOURCE\ >=\ 500 ||
7b072c4d 52 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
98dbe7af 53 !(_POSIX_C_SOURCE\ >=\ 200809L || _XOPEN_SOURCE\ >=\ 700)
2df50e3d
MK
54.TP 4
55.fi
56Before glibc 2.12:
98dbe7af
MK
57_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
58_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
2df50e3d
MK
59.PD
60.RE
61.ad b
8c87824d 62.SH DESCRIPTION
73d8cece 63.SS Standard description
f9f81237 64(From POSIX.1)
fea681da 65The
bed66765 66.BR vfork ()
fea681da 67function has the same effect as
0bfa087b 68.BR fork (2),
d9bfdb9c 69except that the behavior is undefined if the process created by
bed66765 70.BR vfork ()
c13182ef
MK
71either modifies any data other than a variable of type
72.I pid_t
70cbdedf 73used to store the return value from
bed66765 74.BR vfork (),
fea681da 75or returns from the function in which
bed66765 76.BR vfork ()
fea681da 77was called, or calls any other function before successfully calling
0bfa087b 78.BR _exit (2)
fea681da 79or one of the
d806e103 80.BR exec (3)
fea681da 81family of functions.
73d8cece 82.SS Linux description
bed66765 83.BR vfork (),
fea681da
MK
84just like
85.BR fork (2),
86creates a child process of the calling process.
87For details and return value and errors, see
88.BR fork (2).
89.PP
bed66765 90.BR vfork ()
fea681da
MK
91is a special case of
92.BR clone (2).
93It is used to create new processes without copying the page tables of
c13182ef 94the parent process.
600c9aa9 95It may be useful in performance-sensitive applications