kern_fork.c (4ac9ae70836f53e6d351857aedc400151dc62f86) kern_fork.c (af8ad83e5ce4b8d3f02b6c211879b51ba7fcfb5e)
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 * $Id: kern_fork.c,v 1.55 1999/01/26 02:38:10 julian Exp $
39 * $Id: kern_fork.c,v 1.56 1999/03/02 00:28:08 julian Exp $
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>

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

434 * set priority of child to be that of parent
435 */
436 p2->p_estcpu = p1->p_estcpu;
437
438 /*
439 * This begins the section where we must prevent the parent
440 * from being swapped.
441 */
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>

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

434 * set priority of child to be that of parent
435 */
436 p2->p_estcpu = p1->p_estcpu;
437
438 /*
439 * This begins the section where we must prevent the parent
440 * from being swapped.
441 */
442 p1->p_flag |= P_NOSWAP;
442 PHOLD(p1);
443
444 /*
445 * Finish creating the child process. It will return via a different
446 * execution path later. (ie: directly into user mode)
447 */
448 vm_fork(p1, p2, flags);
449
450 /*

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

465 (void) splhigh();
466 p2->p_stat = SRUN;
467 setrunqueue(p2);
468 (void) spl0();
469
470 /*
471 * Now can be swapped.
472 */
443
444 /*
445 * Finish creating the child process. It will return via a different
446 * execution path later. (ie: directly into user mode)
447 */
448 vm_fork(p1, p2, flags);
449
450 /*

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

465 (void) splhigh();
466 p2->p_stat = SRUN;
467 setrunqueue(p2);
468 (void) spl0();
469
470 /*
471 * Now can be swapped.
472 */
473 p1->p_flag &= ~P_NOSWAP;
473 PRELE(p1);
474
475 /*
476 * Preserve synchronization semantics of vfork. If waiting for
477 * child to exec or exit, set P_PPWAIT on child, and sleep on our
478 * proc (in case of exit).
479 */
480 while (p2->p_flag & P_PPWAIT)
481 tsleep(p1, PWAIT, "ppwait", 0);

--- 64 unchanged lines hidden ---
474
475 /*
476 * Preserve synchronization semantics of vfork. If waiting for
477 * child to exec or exit, set P_PPWAIT on child, and sleep on our
478 * proc (in case of exit).
479 */
480 while (p2->p_flag & P_PPWAIT)
481 tsleep(p1, PWAIT, "ppwait", 0);

--- 64 unchanged lines hidden ---