aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/contrib/opensolaris/uts/common/dtrace
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-04-28 22:25:22 +0000
committerMark Johnston <markj@FreeBSD.org>2017-04-28 22:25:22 +0000
commitbabf030fd66684b6e531089a1afdcebe2d477533 (patch)
tree04f40455513547cbe538ab9073eb06109cba8dbd /sys/cddl/contrib/opensolaris/uts/common/dtrace
parentbb4877783caa18336e0c90f67ff3fbfe09ff5cd7 (diff)
downloadsrc-babf030fd66684b6e531089a1afdcebe2d477533.tar.gz
src-babf030fd66684b6e531089a1afdcebe2d477533.zip
Get rid of some ifdef soup in the fasttrap ioctl handler.
No functional change intended. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=317573
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/dtrace')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
index 845da7a70801..b38b311a3311 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -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 cmd, caddr_t arg, int fflag,
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 */