Get rid of some ifdef soup in the fasttrap ioctl handler.
No functional change intended. MFC after: 1 week
This commit is contained in:
parent
bb4877783c
commit
babf030fd6
@ -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 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
|
||||
fasttrap_instr_query_t instr;
|
||||
fasttrap_tracepoint_t *tp;
|
||||
uint_t index;
|
||||
#ifdef illumos
|
||||
#ifdef notyet
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
@ -2396,48 +2369,25 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
|
||||
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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user