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