From owner-svn-src-head@freebsd.org Fri Apr 28 22:25:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D307D54CE7; Fri, 28 Apr 2017 22:25:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6188C126B; Fri, 28 Apr 2017 22:25:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SMPMcU095774; Fri, 28 Apr 2017 22:25:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SMPMrU095773; Fri, 28 Apr 2017 22:25:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201704282225.v3SMPMrU095773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 28 Apr 2017 22:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317573 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 22:25:23 -0000 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 */