svn commit: r313758 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

Mark Johnston markj at FreeBSD.org
Wed Feb 15 06:07:02 UTC 2017


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).


More information about the svn-src-head mailing list