1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
.\" Copyright (c) 1999 Andries Brouwer (aeb@cwi.nl), 1 Nov 1999
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" 1999-11-10: Merged text taken from the page contributed by
.\" Reed H. Petty (rhp@draper.net)
.\"
.\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
.\" all rights reserved.
.\" Translated 1999-12-04, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated 2007-01-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.43
.\"
.TH VFORK 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
vfork \- ҥץƥץߤ
.SH
.B #include <sys/types.h>
.br
.B #include <unistd.h>
.sp
.B pid_t vfork(void);
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR vfork ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.SH
.SS ʤ
(SUSv2 / POSIX ɥեȤ)
.BR vfork ()
ؿ
.BR fork (2)
ƱƯ뤬
.BR vfork ()
Ǻ줿ץ
.BR vfork ()
֤ͤǼƤ
.I pid_t
ѿʳѹꡢ
.BR vfork ()
ƤӽФƤؿ return ꡢ
.BR _exit (2)
.BR exec (3)
²δؿ뤹¾δؿ뤷ư
̤ǤȤۤʤ롣
.SS "LINUX Ǥ"
.BR vfork ()
.BR fork (2)
Ʊ褦˸ƤӽФץλҥץ롣
ܤ֤͡顼ˤĤƤ
.BR fork (2)
Ȥ뤳ȡ
.PP
.BR vfork ()
.BR clone (2)
üʾǤ롣
ƥץΥڡơ֥ΥԡԤ鷺˿ץ
뤿˻Ѥ롣ǽҴʥץꥱˤ
ҥץƤ
.BR execve (2)
ͭѤ⤷ʤ
.PP
.BR vfork ()
.BR fork (2)
Ȱ㤤ҥץ
.BR execve (2)
ޤ
.BR _exit (2)
뤹ޤǿƥץ (suspend) 롣
ҥץ
.BR execve (2)
¹ԤޤǤϡҥץϥåޤƤΥ
ƥץȶͭ롣
ҥץϸߤδؿ return ƤϤʤ餺
.BR exit (3)
⥳뤷ƤϤʤʤ
.BR _exit (2)
ʤХ뤷Ƥ褤
.PP
ʥϥɥϷѾ뤬ͭϤʤ
ƥץؤΥʥϻҥץƥץΥ
夹롣
.SS Ū
Linux ˤ
.BR fork (2)
Ͻԡ (copy-on-write) ڡѤƼƤ롣
Τ
.BR fork (2)
Ѥ뤳Ȥˤä»ϿƥץΥڡơ֥
ʣ뤿ɬפʻ֤ȥǤ롣
ʤ顢Τˤ
.BR fork (2)
ϸƤӽФץΥǡ֤ƤΥԡƤ
ϤФɬפǤäʤʤ顢ƤϤ
.BR exec (3)
¹ԤƤǤ롣
ξθΨ夲뤿 BSD
.BR vfork ()
ƥॳƳƿƥץΥɥ쥹֤˥ԡ
뤫ˡ
.BR execve (2)
뤹뤫 exit ޤǿƥץΥ楹å
ڤ褦ˤ
ƥץϻҥץλѤƤ֤ߤ줿
.BR vfork ()
ϻȤˤΤǤä: 㤨Сƥץѿѹ
褦ˤ뤿ˤϤɤѿ쥸ݻƤ뤫Τ
Фʤʤä
.SH
4.3BSD, POSIX.1-2001.
.\" FIXME . Mar 07: in the draft of the next POSIX revision, the spec for
.\" vfork() has been removed. See if this remains so in final version.
.BR vfork ()
¾Υڥ졼ƥƥƱ̾Υ
äȻƤ뤫⤷ʤʤ
.BR vfork ()
ᤷƤ뤳Ȥϡ
.BR fork (2)
ᤷƤ뤳Ȥϼ夤äơ
ξԤƱΤȤƼƤ⡢ʤ˽Ƥ뤳Ȥˤʤ롣
ä˥ץޡ
.BR execve (2)
ޤ
.BR _exit (2)
¹ԤޤǿƥץߤƤ뤳Ȥ䡢ͭ뤳
ȤˤüưƤˤ٤ǤϤʤ
.\" In AIXv3.1 vfork is equivalent to fork.
.SH
.SS Linux Ǥ
.BR pthread_atfork (3)
Ȥäꤵ줿 fork ϥɥ
NPTL åɥ饤֥ꥳѤޥåɥץǤ
ƤӽФʤLinuxThreads åɥ饤֥Ȥä
ץǤϡfork ϥɥϸƤӽФ롣
(Linux Υåɥ饤֥
.BR pthreads (7)
ȡ)
.SS
.BR vfork ()
ƥॳ 3.0BSD ˸줿
.\" In the release notes for 4.2BSD Sam Leffler wrote: `vfork: Is still
.\" present, but definitely on its way out'.
4.4BSD ˤ
.BR fork (2)
ƱȤʤäNetBSD ǤϺƤƳ줿
http://www.netbsd.org/Documentation/kernel/vfork.html ȡ
Linux Ǥ 2.2.0-pre6 ޤǤ
.BR fork (2)
Ǥä(i386 Ǥ) 2.2.0-pre9 (¾ΥƥǤ
٤) ΩƥॳȤʤä
glibc ǤΥݡȤ glibc-2.0.112 ɲä줿
.SH Х
Linux β˴褵ȤϡषԹȸ٤Ǥ롣
BSD Υޥ˥奢ˤϡ
֤Υƥॳʥƥඦͭ줿ˤ
롣桼
.BR vfork ()
Υ궦ͭǽ˰¸٤ǤϤʤΤʤСΥƥॳ
줿ˤϡ
.BR fork (2)
ƱȤ뤫Ǥ롣פȽƤ롣
ʥΰξܺ٤ƤǥƥऴȤ˰ۤäƤ롣
BSD Υޥ˥奢ˤϡ
֥ǥåɥå֤ˤʤǽΤ
.BR vfork ()
λҥץ
.B SIGTTOU
.B SIGTTIN
ʥƤϤʤʤ;
˽Ϥ
.I ioctl
ϵ뤬ϤߤˤϷ̤ϥե뽪ü (EOF) ˤʤ롣
ȽƤ롣
.\"
.\" As far as I can tell, the following is not true in 2.6.19:
.\" ߤΤȤ (Linux 2.3.25)
.\" .BR strace (1)
.\"
.\" .BR vfork ()
.\" פ뤳ȤǤͥѥåɬפǤ롣
.SH Ϣ
.BR clone (2),
.BR execve (2),
.BR fork (2),
.BR unshare (2),
.BR wait (2)
|