]>
Commit | Line | Data |
---|---|---|
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 |
11 | vfork \- create a child process and block parent | |
0665448b AC |
12 | .SH LIBRARY |
13 | Standard 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 |
23 | Feature 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 | 40 | The |
bed66765 | 41 | .BR vfork () |
fea681da | 42 | function has the same effect as |
0bfa087b | 43 | .BR fork (2), |
d9bfdb9c | 44 | except that the behavior is undefined if the process created by |
bed66765 | 45 | .BR vfork () |
c13182ef MK |
46 | either modifies any data other than a variable of type |
47 | .I pid_t | |
70cbdedf | 48 | used to store the return value from |
bed66765 | 49 | .BR vfork (), |
fea681da | 50 | or returns from the function in which |
bed66765 | 51 | .BR vfork () |
fea681da | 52 | was called, or calls any other function before successfully calling |
0bfa087b | 53 | .BR _exit (2) |
fea681da | 54 | or one of the |
d806e103 | 55 | .BR exec (3) |
fea681da | 56 | family of functions. |
73d8cece | 57 | .SS Linux description |
bed66765 | 58 | .BR vfork (), |
fea681da MK |
59 | just like |
60 | .BR fork (2), | |
61 | creates a child process of the calling process. | |
62 | For details and return value and errors, see | |
63 | .BR fork (2). | |
c6d039a3 | 64 | .P |
bed66765 | 65 | .BR vfork () |
fea681da MK |
66 | is a special case of |
67 | .BR clone (2). | |
68 | It is used to create new processes without copying the page tables of | |
c13182ef | 69 | the parent process. |
600c9aa9 | 70 | It may be useful in performance-sensitive applications |