kern_fork.c (53842) | kern_fork.c (54188) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 |
39 * $FreeBSD: head/sys/kern/kern_fork.c 53842 1999-11-28 17:51:09Z dan $ | 39 * $FreeBSD: head/sys/kern/kern_fork.c 54188 1999-12-06 04:53:08Z luoqi $ |
40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> 47#include <sys/filedesc.h> --- 114 unchanged lines hidden (view full) --- 162 return (EINVAL); 163 164 /* 165 * Here we don't create a new process, but we divorce 166 * certain parts of a process from itself. 167 */ 168 if ((flags & RFPROC) == 0) { 169 | 40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> 47#include <sys/filedesc.h> --- 114 unchanged lines hidden (view full) --- 162 return (EINVAL); 163 164 /* 165 * Here we don't create a new process, but we divorce 166 * certain parts of a process from itself. 167 */ 168 if ((flags & RFPROC) == 0) { 169 |
170 /* 171 * Divorce the memory, if it is shared, essentially 172 * this changes shared memory amongst threads, into 173 * COW locally. 174 */ 175 if ((flags & RFMEM) == 0) { 176 if (p1->p_vmspace->vm_refcnt > 1) { 177 vmspace_unshare(p1); 178 } 179 } | 170 vm_fork(p1, 0, flags); |
180 181 /* 182 * Close all file descriptors. 183 */ 184 if (flags & RFCFDG) { 185 struct filedesc *fdtmp; 186 fdtmp = fdinit(p1); 187 fdfree(p1); --- 364 unchanged lines hidden --- | 171 172 /* 173 * Close all file descriptors. 174 */ 175 if (flags & RFCFDG) { 176 struct filedesc *fdtmp; 177 fdtmp = fdinit(p1); 178 fdfree(p1); --- 364 unchanged lines hidden --- |