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).
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to