svn commit: r309599 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Mark Johnston
markj at FreeBSD.org
Tue Dec 6 04:28:57 UTC 2016
Author: markj
Date: Tue Dec 6 04:28:56 2016
New Revision: 309599
URL: https://svnweb.freebsd.org/changeset/base/309599
Log:
libdtrace: Don't use a read-only handle for enumerating pid probes.
Enumeration of return probes involves disassembling subroutines in the
target process, and ptrace(2) is currently used to read from the target
process. libproc could read from the backing file instead to avoid this
problem, but in the common case libdtrace will have a writeable handle
on the process anyway. In particular, a writeable handle is needed to list
USDT probes, and libdtrace will cache such a handle for processes that it
controls via dtrace -c and -p.
Modified:
head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Tue Dec 6 04:23:32 2016 (r309598)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Tue Dec 6 04:28:56 2016 (r309599)
@@ -729,8 +729,13 @@ dt_pid_create_probes(dtrace_probedesc_t
(void) snprintf(provname, sizeof (provname), "pid%d", (int)pid);
if (gmatch(provname, pdp->dtpd_provider) != 0) {
+#ifdef __FreeBSD__
+ if ((P = dt_proc_grab(dtp, pid, 0, 1)) == NULL)
+#else
if ((P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE,
- 0)) == NULL) {
+ 0)) == NULL)
+#endif
+ {
(void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_GRAB,
"failed to grab process %d", (int)pid);
return (-1);
More information about the svn-src-all
mailing list