Deleted Added
full compact
kern_fork.c (211616) kern_fork.c (212357)
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>
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 211616 2010-08-22 11:18:57Z rpaulo $");
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
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#ifdef KDTRACE_HOOKS
675 /*
674 /*
676 * Tell the DTrace fasttrap provider about the new process
677 * if it has registered an interest.
678 */
679 if (dtrace_fasttrap_fork)
680 dtrace_fasttrap_fork(p1, p2);
681#endif
682
683 /*
684 * This begins the section where we must prevent the parent
685 * from being swapped.
686 */
687 _PHOLD(p1);
688 PROC_UNLOCK(p1);
689
690 /*
691 * Attach the new process to its parent.

--- 47 unchanged lines hidden (view full) ---

739
740 /*
741 * Set the child start time and mark the process as being complete.
742 */
743 microuptime(&p2->p_stats->p_start);
744 PROC_SLOCK(p2);
745 p2->p_state = PRS_NORMAL;
746 PROC_SUNLOCK(p2);
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
747
748 /*
749 * If RFSTOPPED not requested, make child runnable and add to
750 * run queue.
751 */
752 if ((flags & RFSTOPPED) == 0) {
753 thread_lock(td2);
754 TD_SET_CAN_RUN(td2);

--- 123 unchanged lines hidden ---
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 ---