Author: markj
Date: Fri Apr 28 22:25:22 2017
New Revision: 317573
URL: https://svnweb.freebsd.org/changeset/base/317573

Log:
  Get rid of some ifdef soup in the fasttrap ioctl handler.
  
  No functional change intended.
  
  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      Fri Apr 
28 22:24:21 2017        (r317572)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c      Fri Apr 
28 22:25:22 2017        (r317573)
@@ -2269,10 +2269,6 @@ static int
 fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
     struct thread *td)
 {
-#ifdef notyet
-       struct kinfo_proc kp;
-       const cred_t *cr = td->td_ucred;
-#endif
        if (!dtrace_attached())
                return (EAGAIN);
 
@@ -2328,47 +2324,24 @@ fasttrap_ioctl(struct cdev *dev, u_long 
                        proc_t *p;
                        pid_t pid = probe->ftps_pid;
 
-#ifdef illumos
                        mutex_enter(&pidlock);
-#endif
                        /*
                         * Report an error if the process doesn't exist
                         * or is actively being birthed.
                         */
-                       sx_slock(&proctree_lock);
-                       p = pfind(pid);
-                       if (p)
-                               fill_kinfo_proc(p, &kp);
-                       sx_sunlock(&proctree_lock);
-                       if (p == NULL || kp.ki_stat == SIDL) {
-#ifdef illumos
+                       if ((p = pfind(pid)) == NULL || p->p_stat == SIDL) {
                                mutex_exit(&pidlock);
-#endif
                                return (ESRCH);
                        }
-#ifdef illumos
                        mutex_enter(&p->p_lock);
                        mutex_exit(&pidlock);
-#else
-                       PROC_LOCK_ASSERT(p, MA_OWNED);
-#endif
 
-#ifdef notyet
                        if ((ret = priv_proc_cred_perm(cr, p, NULL,
                            VREAD | VWRITE)) != 0) {
-#ifdef illumos
                                mutex_exit(&p->p_lock);
-#else
-                               PROC_UNLOCK(p);
-#endif
                                return (ret);
                        }
-#endif /* notyet */
-#ifdef illumos
                        mutex_exit(&p->p_lock);
-#else
-                       PROC_UNLOCK(p);
-#endif
                }
 #endif /* notyet */
 
@@ -2382,7 +2355,7 @@ err:
                fasttrap_instr_query_t instr;
                fasttrap_tracepoint_t *tp;
                uint_t index;
-#ifdef illumos
+#ifdef notyet
                int ret;
 #endif
 
@@ -2396,48 +2369,25 @@ err:
                        proc_t *p;
                        pid_t pid = instr.ftiq_pid;
 
-#ifdef illumos
                        mutex_enter(&pidlock);
-#endif
                        /*
                         * Report an error if the process doesn't exist
                         * or is actively being birthed.
                         */
-                       sx_slock(&proctree_lock);
-                       p = pfind(pid);
-                       if (p)
-                               fill_kinfo_proc(p, &kp);
-                       sx_sunlock(&proctree_lock);
-                       if (p == NULL || kp.ki_stat == SIDL) {
-#ifdef illumos
+                       if ((p == pfind(pid)) == NULL || p->p_stat == SIDL) {
                                mutex_exit(&pidlock);
-#endif
                                return (ESRCH);
                        }
-#ifdef illumos
                        mutex_enter(&p->p_lock);
                        mutex_exit(&pidlock);
-#else
-                       PROC_LOCK_ASSERT(p, MA_OWNED);
-#endif
 
-#ifdef notyet
                        if ((ret = priv_proc_cred_perm(cr, p, NULL,
                            VREAD)) != 0) {
-#ifdef illumos
                                mutex_exit(&p->p_lock);
-#else
-                               PROC_UNLOCK(p);
-#endif
                                return (ret);
                        }
-#endif /* notyet */
 
-#ifdef illumos
                        mutex_exit(&p->p_lock);
-#else
-                       PROC_UNLOCK(p);
-#endif
                }
 #endif /* notyet */
 
_______________________________________________
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