From owner-svn-src-all@FreeBSD.ORG Thu Apr 5 10:30:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 097D11065670; Thu, 5 Apr 2012 10:30:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E821E8FC14; Thu, 5 Apr 2012 10:30:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q35AUscY054693; Thu, 5 Apr 2012 10:30:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q35AUsYO054691; Thu, 5 Apr 2012 10:30:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201204051030.q35AUsYO054691@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Apr 2012 10:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233919 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2012 10:30:55 -0000 Author: kib Date: Thu Apr 5 10:30:54 2012 New Revision: 233919 URL: http://svn.freebsd.org/changeset/base/233919 Log: MFC r233808: Add helper function to remove the process from the orphans list and use it instead of inlined code. Modified: stable/9/sys/kern/kern_exit.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_exit.c ============================================================================== --- stable/9/sys/kern/kern_exit.c Thu Apr 5 07:59:59 2012 (r233918) +++ stable/9/sys/kern/kern_exit.c Thu Apr 5 10:30:54 2012 (r233919) @@ -100,6 +100,18 @@ SDT_PROBE_ARGTYPE(proc, kernel, , exit, /* Hook for NFS teardown procedure. */ void (*nlminfo_release_p)(struct proc *p); +static void +clear_orphan(struct proc *p) +{ + + PROC_LOCK_ASSERT(p, MA_OWNED); + + if (p->p_flag & P_ORPHAN) { + LIST_REMOVE(p, p_orphan); + p->p_flag &= ~P_ORPHAN; + } +} + /* * exit -- death of process. */ @@ -739,10 +751,7 @@ proc_reap(struct thread *td, struct proc sx_xunlock(&allproc_lock); LIST_REMOVE(p, p_sibling); PROC_LOCK(p); - if (p->p_flag & P_ORPHAN) { - LIST_REMOVE(p, p_orphan); - p->p_flag &= ~P_ORPHAN; - } + clear_orphan(p); PROC_UNLOCK(p); leavepgrp(p); #ifdef PROCDESC @@ -987,10 +996,7 @@ proc_reparent(struct proc *child, struct LIST_REMOVE(child, p_sibling); LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); - if (child->p_flag & P_ORPHAN) { - LIST_REMOVE(child, p_orphan); - child->p_flag &= ~P_ORPHAN; - } + clear_orphan(child); if (child->p_flag & P_TRACED) { LIST_INSERT_HEAD(&child->p_pptr->p_orphans, child, p_orphan); child->p_flag |= P_ORPHAN;