]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/vfork.2
man*/: srcfix (Use .P instead of .PP or .LP)
[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.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
5.\"
6.\" 1999-11-10: Merged text taken from the page contributed by
7.\" Reed H. Petty (rhp@draper.net)
8.\"
4c1c5274 9.TH vfork 2 (date) "Linux man-pages (unreleased)"
fea681da
MK
10.SH NAME
11vfork \- create a child process and block parent
0665448b
AC
12.SH LIBRARY
13Standard C library
8fc3b2cf 14.RI ( libc ", " \-lc )
fea681da 15.SH SYNOPSIS
4653ec6e 16.nf
fea681da 17.B #include <unistd.h>
c6d039a3 18.P
fea681da 19.B pid_t vfork(void);
4653ec6e 20.fi
c6d039a3 21.P
d39ad78f 22.RS -4
cc4615cc
MK
23Feature Test Macro Requirements for glibc (see
24.BR feature_test_macros (7)):
d39ad78f 25.RE
c6d039a3 26.P
cc4615cc 27.BR vfork ():
2df50e3d 28.nf
9d2adbae 29 Since glibc 2.12:
5c10d2c5 30 (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
9d2adbae 31 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
75c018a1 32 || /* glibc <= 2.19: */ _BSD_SOURCE
9d2adbae 33 Before glibc 2.12:
5c10d2c5
MK
34 _BSD_SOURCE || _XOPEN_SOURCE >= 500
35.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
9d2adbae 36.fi
8c87824d 37.SH DESCRIPTION
73d8cece 38.SS Standard description
f9f81237 39(From POSIX.1)
fea681da 40The
bed66765 41.BR vfork ()
fea681da 42function has the same effect as
0bfa087b 43.BR fork (2),
d9bfdb9c 44except that the behavior is undefined if the process created by
bed66765 45.BR vfork ()
c13182ef
MK
46either modifies any data other than a variable of type
47.I pid_t
70cbdedf 48used to store the return value from
bed66765 49.BR vfork (),
fea681da 50or returns from the function in which
bed66765 51.BR vfork ()
fea681da 52was called, or calls any other function before successfully calling
0bfa087b 53.BR _exit (2)
fea681da 54or one of the
d806e103 55.BR exec (3)
fea681da 56family of functions.
73d8cece 57.SS Linux description
bed66765 58.BR vfork (),
fea681da
MK
59just like
60.BR fork (2),
61creates a child process of the calling process.
62For details and return value and errors, see
63.BR fork (2).
c6d039a3 64.P
bed66765 65.BR vfork ()
fea681da
MK
66is a special case of
67.BR clone (2).
68It is used to create new processes without copying the page tables of
c13182ef 69the parent process.
600c9aa9 70It may be useful in performance-sensitive applications