From owner-p4-projects@FreeBSD.ORG Sat Oct 14 15:39:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 13B3C16A519; Sat, 14 Oct 2006 15:39:34 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E5C6016A501 for ; Sat, 14 Oct 2006 15:39:33 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08CF043D45 for ; Sat, 14 Oct 2006 15:39:25 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9EFdPHa035285 for ; Sat, 14 Oct 2006 15:39:25 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9EFdPmG035282 for perforce@freebsd.org; Sat, 14 Oct 2006 15:39:25 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sat, 14 Oct 2006 15:39:25 GMT Message-Id: <200610141539.k9EFdPmG035282@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 107900 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Oct 2006 15:39:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=107900 Change 107900 by rdivacky@rdivacky_witten on 2006/10/14 15:38:47 Rewritten, yet still panicing version of pdeath_signal. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysvec.c#3 edit .. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#9 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#7 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_sysvec.c#3 edit .. //depot/projects/linuxolator/src/sys/kern/kern_exit.c#5 edit .. //depot/projects/linuxolator/src/sys/sys/eventhandler.h#3 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysvec.c#3 (text+ko) ==== @@ -129,7 +129,6 @@ static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; static eventhandler_tag linux_exec_tag; -static eventhandler_tag linux_reparent_tag; /* * Linux syscalls return negative errno's, we do positive and map them @@ -1088,8 +1087,6 @@ NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); - linux_reparent_tag = EVENTHANDLER_REGISTER(reparent, linux_reparent, - NULL, 1000); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else @@ -1117,7 +1114,6 @@ EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); - EVENTHANDLER_DEREGISTER(reparent, linux_reparent_tag); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#9 (text+ko) ==== @@ -152,6 +152,7 @@ int error; struct thread *td = FIRST_THREAD_IN_PROC(p); int *child_clear_tid; + struct proc *q, *nq; if (__predict_true(p->p_sysent != &elf_linux_sysvec)) return; @@ -205,6 +206,24 @@ /* clean the stuff up */ free(em, M_LINUX); + + /* this is a little weird but rewritten from exit1() */ + sx_xlock(&proctree_lock); + q = LIST_FIRST(&p->p_children); + for (; q != NULL; q = nq) { + nq = LIST_NEXT(q, p_sibling); + if (__predict_true(q->p_sysent != &elf_linux_sysvec)) + break; + em = em_find(q, EMUL_UNLOCKED); + KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", q->p_pid)); + if (em->pdeath_signal != 0) { + PROC_LOCK(q); + psignal(q, em->pdeath_signal); + PROC_UNLOCK(q); + } + EMUL_UNLOCK(&emul_lock); + } + sx_xunlock(&proctree_lock); } /* @@ -300,22 +319,3 @@ EMUL_UNLOCK(&emul_lock); return 0; } - -/* p is locked */ -void -linux_reparent(void *arg __unused, struct proc *p) -{ - struct linux_emuldata *em; - - if (__predict_true(p->p_sysent != &elf_linux_sysvec)) - return; - - /* do this only if the parent is exiting */ - if (p->p_pptr->p_flag & P_WEXIT) { - em = em_find(p, EMUL_UNLOCKED); - KASSERT(em != NULL, ("linux_reparent: emuldata not found.\n")); - if (em->pdeath_signal != 0) - psignal(p, em->pdeath_signal); - EMUL_UNLOCK(&emul_lock); - } -} ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#7 (text+ko) ==== ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_sysvec.c#3 (text+ko) ==== @@ -113,7 +113,6 @@ static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; static eventhandler_tag linux_exec_tag; -static eventhandler_tag linux_reparent_tag; /* * Linux syscalls return negative errno's, we do positive and map them @@ -928,8 +927,6 @@ NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); - linux_reparent_tag = EVENTHANDLER_REGISTER(reparent, linux_reparent, - NULL, 1000); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else @@ -957,7 +954,6 @@ EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); - EVENTHANDLER_DEREGISTER(reparent, linux_reparent_tag); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else ==== //depot/projects/linuxolator/src/sys/kern/kern_exit.c#5 (text+ko) ==== @@ -897,9 +897,6 @@ if (child->p_pptr == parent) return; - /* we want to have old parent accessible via p_pptr */ - EVENTHANDLER_INVOKE(reparent, child); - LIST_REMOVE(child, p_sibling); LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); child->p_pptr = parent; ==== //depot/projects/linuxolator/src/sys/sys/eventhandler.h#3 (text+ko) ==== @@ -179,6 +179,4 @@ typedef void(*schedtail_fn)(void *, struct proc *); EVENTHANDLER_DECLARE(schedtail, schedtail_fn); -typedef void(*reparent_fn)(void *, struct proc *); -EVENTHANDLER_DECLARE(reparent, reparent_fn); #endif /* SYS_EVENTHANDLER_H */