kern_fork.c (87965) | kern_fork.c (88088) |
---|---|
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 87965 2001-12-14 23:37:35Z jhb $ | 39 * $FreeBSD: head/sys/kern/kern_fork.c 88088 2001-12-18 00:27:18Z jhb $ |
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> --- 414 unchanged lines hidden (view full) --- 462 * The p_stats and p_sigacts substructs are set in vm_forkproc. 463 */ 464 p2->p_flag = 0; 465 mtx_lock_spin(&sched_lock); 466 p2->p_sflag = PS_INMEM; 467 if (p1->p_sflag & PS_PROFIL) 468 startprofclock(p2); 469 mtx_unlock_spin(&sched_lock); | 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> --- 414 unchanged lines hidden (view full) --- 462 * The p_stats and p_sigacts substructs are set in vm_forkproc. 463 */ 464 p2->p_flag = 0; 465 mtx_lock_spin(&sched_lock); 466 p2->p_sflag = PS_INMEM; 467 if (p1->p_sflag & PS_PROFIL) 468 startprofclock(p2); 469 mtx_unlock_spin(&sched_lock); |
470 /* 471 * We start off holding one spinlock after fork: sched_lock. 472 */ | |
473 PROC_LOCK(p1); 474 p2->p_ucred = crhold(p1->p_ucred); 475 p2->p_thread.td_ucred = crhold(p2->p_ucred); /* XXXKSE */ 476 477 if (p2->p_args) 478 p2->p_args->ar_ref++; 479 480 if (flags & RFSIGSHARE) { --- 280 unchanged lines hidden (view full) --- 761 struct proc *p = td->td_proc; 762 763 td->td_kse->ke_oncpu = PCPU_GET(cpuid); 764 /* 765 * Setup the sched_lock state so that we can release it. 766 */ 767 sched_lock.mtx_lock = (uintptr_t)td; 768 sched_lock.mtx_recurse = 0; | 470 PROC_LOCK(p1); 471 p2->p_ucred = crhold(p1->p_ucred); 472 p2->p_thread.td_ucred = crhold(p2->p_ucred); /* XXXKSE */ 473 474 if (p2->p_args) 475 p2->p_args->ar_ref++; 476 477 if (flags & RFSIGSHARE) { --- 280 unchanged lines hidden (view full) --- 758 struct proc *p = td->td_proc; 759 760 td->td_kse->ke_oncpu = PCPU_GET(cpuid); 761 /* 762 * Setup the sched_lock state so that we can release it. 763 */ 764 sched_lock.mtx_lock = (uintptr_t)td; 765 sched_lock.mtx_recurse = 0; |
769 /* 770 * XXX: We really shouldn't have to do this. 771 */ 772 mtx_intr_enable(&sched_lock); | 766 td->td_critnest = 1; 767 td->td_savecrit = CRITICAL_FORK; |
773 CTR3(KTR_PROC, "fork_exit: new proc %p (pid %d, %s)", p, p->p_pid, 774 p->p_comm); 775 if (PCPU_GET(switchtime.tv_sec) == 0) 776 microuptime(PCPU_PTR(switchtime)); 777 PCPU_SET(switchticks, ticks); 778 mtx_unlock_spin(&sched_lock); 779 780 /* --- 47 unchanged lines hidden --- | 768 CTR3(KTR_PROC, "fork_exit: new proc %p (pid %d, %s)", p, p->p_pid, 769 p->p_comm); 770 if (PCPU_GET(switchtime.tv_sec) == 0) 771 microuptime(PCPU_PTR(switchtime)); 772 PCPU_SET(switchticks, ticks); 773 mtx_unlock_spin(&sched_lock); 774 775 /* --- 47 unchanged lines hidden --- |