]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vfork.2
pipe.2: Note that 'pipefd' is left unchanged in the event of an error
[thirdparty/man-pages.git] / man2 / vfork.2
CommitLineData
fea681da 1.\" Copyright (c) 1999 Andries Brouwer (aeb@cwi.nl), 1 Nov 1999
9a95dcb6 2.\" and Copyright 2006, 2012, 2017 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" 1999-11-10: Merged text taken from the page contributed by
27.\" Reed H. Petty (rhp@draper.net)
28.\"
4b8c67d9 29.TH VFORK 2 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da
MK
30.SH NAME
31vfork \- create a child process and block parent
32.SH SYNOPSIS
33.B #include <sys/types.h>
34.br
35.B #include <unistd.h>
68e4db0a 36.PP
fea681da 37.B pid_t vfork(void);
68e4db0a 38.PP
cc4615cc
MK
39.in -4n
40Feature Test Macro Requirements for glibc (see
41.BR feature_test_macros (7)):
42.in
68e4db0a 43.PP
cc4615cc 44.BR vfork ():
2df50e3d
MK
45.ad l
46.RS 4
47.PD 0
48.TP 4
49Since glibc 2.12:
50.nf
f8619b6a
MK
51(_XOPEN_SOURCE\ >=\ 500) && ! (_POSIX_C_SOURCE\ >=\ 200809L)
52 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
53 || /* Glibc versions <= 2.19: */ _BSD_SOURCE
2df50e3d
MK
54.TP 4
55.fi
56Before glibc 2.12:
cf7fa0a1
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