kern_exit.c (7757a1b4dc60696d9a95137ee0a2accd4ee680f4) | kern_exit.c (c209e3e2e6e00b30c991764ca28c5dac26f023fc) |
---|---|
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. --- 833 unchanged lines hidden (view full) --- 842 PROC_UNLOCK(p); 843 sx_xunlock(&proctree_lock); 844 return; 845 } 846 847 PROC_LOCK(q); 848 sigqueue_take(p->p_ksi); 849 PROC_UNLOCK(q); | 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. --- 833 unchanged lines hidden (view full) --- 842 PROC_UNLOCK(p); 843 sx_xunlock(&proctree_lock); 844 return; 845 } 846 847 PROC_LOCK(q); 848 sigqueue_take(p->p_ksi); 849 PROC_UNLOCK(q); |
850 PROC_UNLOCK(p); | |
851 852 /* 853 * If we got the child via a ptrace 'attach', we need to give it back 854 * to the old parent. 855 */ | 850 851 /* 852 * If we got the child via a ptrace 'attach', we need to give it back 853 * to the old parent. 854 */ |
856 if (p->p_oppid != 0) { | 855 if (p->p_oppid != 0 && p->p_oppid != p->p_pptr->p_pid) { 856 PROC_UNLOCK(p); |
857 t = proc_realparent(p); 858 PROC_LOCK(t); 859 PROC_LOCK(p); 860 proc_reparent(p, t); 861 p->p_oppid = 0; 862 PROC_UNLOCK(p); 863 pksignal(t, SIGCHLD, p->p_ksi); 864 wakeup(t); 865 cv_broadcast(&p->p_pwait); 866 PROC_UNLOCK(t); 867 sx_xunlock(&proctree_lock); 868 return; 869 } | 857 t = proc_realparent(p); 858 PROC_LOCK(t); 859 PROC_LOCK(p); 860 proc_reparent(p, t); 861 p->p_oppid = 0; 862 PROC_UNLOCK(p); 863 pksignal(t, SIGCHLD, p->p_ksi); 864 wakeup(t); 865 cv_broadcast(&p->p_pwait); 866 PROC_UNLOCK(t); 867 sx_xunlock(&proctree_lock); 868 return; 869 } |
870 p->p_oppid = 0; 871 PROC_UNLOCK(p); |
|
870 871 /* 872 * Remove other references to this process to ensure we have an 873 * exclusive reference. 874 */ 875 sx_xlock(&allproc_lock); 876 LIST_REMOVE(p, p_list); /* off zombproc */ 877 sx_xunlock(&allproc_lock); --- 469 unchanged lines hidden --- | 872 873 /* 874 * Remove other references to this process to ensure we have an 875 * exclusive reference. 876 */ 877 sx_xlock(&allproc_lock); 878 LIST_REMOVE(p, p_list); /* off zombproc */ 879 sx_xunlock(&allproc_lock); --- 469 unchanged lines hidden --- |