Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2017 06:07:01 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313758 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Message-ID:  <201702150607.v1F671EC069914@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Feb 15 06:07:01 2017
New Revision: 313758
URL: https://svnweb.freebsd.org/changeset/base/313758

Log:
  Use pget() instead of pfind() in fasttrap_pid_{enable,disable}().
  
  Suggested by:	mjg
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Feb 15 02:52:43 2017	(r313757)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Feb 15 06:07:01 2017	(r313758)
@@ -1246,15 +1246,8 @@ fasttrap_pid_enable(void *arg, dtrace_id
 	ASSERT(!(p->p_flag & SVFORK));
 	mutex_exit(&p->p_lock);
 #else
-	if ((p = pfind(probe->ftp_pid)) == NULL)
+	if (pget(probe->ftp_pid, PGET_HOLD | PGET_NOTWEXIT, &p) != 0)
 		return;
-	if ((p->p_flag & P_WEXIT) != 0) {
-		PROC_UNLOCK(p);
-		return;
-	}
-
-	_PHOLD(p);
-	PROC_UNLOCK(p);
 #endif
 
 	/*
@@ -1333,17 +1326,8 @@ fasttrap_pid_disable(void *arg, dtrace_i
 	 * provider lock as a point of mutual exclusion to prevent other
 	 * DTrace consumers from disabling this probe.
 	 */
-	if ((p = pfind(probe->ftp_pid)) != NULL) {
-#ifdef __FreeBSD__
-		if (p->p_flag & P_WEXIT) {
-			PROC_UNLOCK(p);
-			p = NULL;
-		} else {
-			_PHOLD(p);
-			PROC_UNLOCK(p);
-		}
-#endif
-	}
+	if (pget(probe->ftp_pid, PGET_HOLD | PGET_NOTWEXIT, &p) != 0)
+		p = NULL;
 
 	/*
 	 * Disable all the associated tracepoints (for fully enabled probes).



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