1/*
2 * Copyright (c) 1994, Sean Eric Fagan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 14 unchanged lines hidden (view full) ---
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/kern/sys_process.c 91140 2002-02-23 11:12:57Z tanimura $
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>
38#include <sys/sysproto.h>
39#include <sys/proc.h>
--- 470 unchanged lines hidden (view full) ---
510
511 if (uap->req == PT_DETACH) {
512 /* reset process parent */
513 sx_xlock(&proctree_lock);
514 if (p->p_oppid != p->p_pptr->p_pid) {
515 struct proc *pp;
516
517 pp = pfind(p->p_oppid);
518 if (pp == NULL)
519 pp = initproc;
520 else
521 PROC_UNLOCK(pp);
522 PROC_LOCK(p);
523 proc_reparent(p, pp);
524 } else
525 PROC_LOCK(p);
526 p->p_flag &= ~(P_TRACED | P_WAITED);
527 p->p_oppid = 0;
528 PROC_UNLOCK(p);
529 sx_xunlock(&proctree_lock);
--- 155 unchanged lines hidden ---
2 * Copyright (c) 1994, Sean Eric Fagan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 14 unchanged lines hidden (view full) ---
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/kern/sys_process.c 91140 2002-02-23 11:12:57Z tanimura $
32 */
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>
38#include <sys/sysproto.h>
39#include <sys/proc.h>
--- 470 unchanged lines hidden (view full) ---
510
511 if (uap->req == PT_DETACH) {
512 /* reset process parent */
513 sx_xlock(&proctree_lock);
514 if (p->p_oppid != p->p_pptr->p_pid) {
515 struct proc *pp;
516
517 pp = pfind(p->p_oppid);
518 if (pp == NULL)
519 pp = initproc;
520 else
521 PROC_UNLOCK(pp);
522 PROC_LOCK(p);
523 proc_reparent(p, pp);
524 } else
525 PROC_LOCK(p);
526 p->p_flag &= ~(P_TRACED | P_WAITED);
527 p->p_oppid = 0;
528 PROC_UNLOCK(p);
529 sx_xunlock(&proctree_lock);
--- 155 unchanged lines hidden ---