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. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_fork.c 212357 2010-09-09 09:58:05Z rpaulo $"); |
39 40#include "opt_kdtrace.h" 41#include "opt_ktrace.h" 42#include "opt_kstack_pages.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/sysproto.h> --- 619 unchanged lines hidden (view full) --- 666 * If PF_FORK is set, the child process inherits the 667 * procfs ioctl flags from its parent. 668 */ 669 if (p1->p_pfsflags & PF_FORK) { 670 p2->p_stops = p1->p_stops; 671 p2->p_pfsflags = p1->p_pfsflags; 672 } 673 |
674 /* |
675 * This begins the section where we must prevent the parent 676 * from being swapped. 677 */ 678 _PHOLD(p1); 679 PROC_UNLOCK(p1); 680 681 /* 682 * Attach the new process to its parent. --- 47 unchanged lines hidden (view full) --- 730 731 /* 732 * Set the child start time and mark the process as being complete. 733 */ 734 microuptime(&p2->p_stats->p_start); 735 PROC_SLOCK(p2); 736 p2->p_state = PRS_NORMAL; 737 PROC_SUNLOCK(p2); |
738#ifdef KDTRACE_HOOKS 739 /* 740 * Tell the DTrace fasttrap provider about the new process 741 * if it has registered an interest. We have to do this only after 742 * p_state is PRS_NORMAL since the fasttrap module will use pfind() 743 * later on. 744 */ 745 if (dtrace_fasttrap_fork) { 746 PROC_LOCK(p1); 747 PROC_LOCK(p2); 748 dtrace_fasttrap_fork(p1, p2); 749 PROC_UNLOCK(p2); 750 PROC_UNLOCK(p1); 751 } 752#endif |
753 754 /* 755 * If RFSTOPPED not requested, make child runnable and add to 756 * run queue. 757 */ 758 if ((flags & RFSTOPPED) == 0) { 759 thread_lock(td2); 760 TD_SET_CAN_RUN(td2); --- 123 unchanged lines hidden --- |