Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Apr 2012 10:30:54 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r233919 - stable/9/sys/kern
Message-ID:  <201204051030.q35AUsYO054691@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204051030.q35AUsYO054691>