[DTrace-devel] [PATCH 03/47] Remove obsolete dt_fd, dt_ftfd, and dt_fterr
Kris Van Hees
kris.van.hees at oracle.com
Sun May 3 20:16:35 PDT 2020
Given that DTrace no longer makes use of the ioctl() interface to a
DTrace kernel component we can remove all references to these members
in dtrace_hdl_t. We retain dtrace_ctlfd() because it is part of the
public API, and dt_ioctl() because various parts of libdtrace still
need to rewritten to replace the ioctl() use.
Orabug: 31220516
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
libdtrace/dt_impl.h | 3 ---
libdtrace/dt_open.c | 13 ++++++-------
libdtrace/dt_pid.c | 27 +++------------------------
libdtrace/dt_subr.c | 14 ++++++--------
4 files changed, 15 insertions(+), 42 deletions(-)
diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
index 0630dd4c..62a9b0a9 100644
--- a/libdtrace/dt_impl.h
+++ b/libdtrace/dt_impl.h
@@ -330,9 +330,6 @@ struct dtrace_hdl {
int dt_version; /* library version requested by client */
int dt_ctferr; /* error resulting from last CTF failure */
int dt_errno; /* error resulting from last failed operation */
- int dt_fd; /* file descriptor for dtrace pseudo-device */
- int dt_ftfd; /* file descriptor for fasttrap pseudo-device */
- int dt_fterr; /* saved errno from failed open of dt_ftfd */
int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */
int dt_ddefs_fd; /* file descriptor for D CTF debugging cache */
int dt_stdout_fd; /* file descriptor for saved stdout */
diff --git a/libdtrace/dt_open.c b/libdtrace/dt_open.c
index ce8e71a1..6b0ba71d 100644
--- a/libdtrace/dt_open.c
+++ b/libdtrace/dt_open.c
@@ -710,8 +710,6 @@ dt_vopen(int version, int flags, int *errp,
dtp->dt_xlatemode = DT_XL_STATIC;
dtp->dt_stdcmode = DT_STDC_XA;
dtp->dt_version = version;
- dtp->dt_fd = -1; /* FIXME: will be removed later */
- dtp->dt_ftfd = -1; /* FIXME: will be removed later */
dtp->dt_cdefs_fd = -1;
dtp->dt_ddefs_fd = -1;
dtp->dt_stdout_fd = -1;
@@ -1190,10 +1188,6 @@ dtrace_close(dtrace_hdl_t *dtp)
dt_pcap_destroy(dtp);
- if (dtp->dt_fd != -1)
- close(dtp->dt_fd);
- if (dtp->dt_ftfd != -1)
- close(dtp->dt_ftfd);
if (dtp->dt_cdefs_fd != -1)
close(dtp->dt_cdefs_fd);
if (dtp->dt_ddefs_fd != -1)
@@ -1240,8 +1234,13 @@ dtrace_close(dtrace_hdl_t *dtp)
dt_debug_dump(0);
}
+/*
+ * DTrace no longer uses an ioctl() interface to communicate with a DTrace
+ * kernel component. We retain this function because it is part of the
+ * libdtrace API.
+ */
int
dtrace_ctlfd(dtrace_hdl_t *dtp)
{
- return (dtp->dt_fd);
+ return -1;
}
diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 3e331a5a..2d6e3a7c 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -101,11 +101,7 @@ dt_pid_create_fbt_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
ftp->ftps_glen = 0; /* no glob pattern */
ftp->ftps_gstr[0] = '\0';
- if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
- dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
- strerror(errno));
- return (dt_set_errno(dtp, errno));
- }
+ /* Create a probe using 'ftp'. */
return (1);
}
@@ -121,11 +117,7 @@ dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
strncpy(ftp->ftps_gstr, pattern, ftp->ftps_glen + 1);
- if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
- dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
- strerror(errno));
- return (dt_set_errno(dtp, errno));
- }
+ /* Create a probe using 'ftp'. */
return (1);
}
@@ -699,20 +691,7 @@ dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
if ((pid = dt_pid_get_pid(pdp, dtp, pcb, NULL)) == -1)
return (-1);
- if (dtp->dt_ftfd == -1) {
- if (dtp->dt_fterr == ENOENT) {
- (void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_NODEV,
- "pid provider is not installed on this system");
- } else {
- (void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_NODEV,
- "pid provider is not available: %s",
- strerror(dtp->dt_fterr));
- }
-
- return (-1);
- }
-
- (void) snprintf(provname, sizeof (provname), "pid%d", (int)pid);
+ snprintf(provname, sizeof (provname), "pid%d", (int)pid);
if (gmatch(provname, pdp->prv) != 0) {
pid = dt_proc_grab_lock(dtp, pid, DTRACE_PROC_WAITING);
diff --git a/libdtrace/dt_subr.c b/libdtrace/dt_subr.c
index 8610e47d..14824578 100644
--- a/libdtrace/dt_subr.c
+++ b/libdtrace/dt_subr.c
@@ -447,17 +447,15 @@ dt_cpp_pop_arg(dtrace_hdl_t *dtp)
return (arg);
}
+/*
+ * This function will be removed in the near future because we no longer use
+ * the DTrace ioctl() interface. It is retained for now while other code in
+ * libdtrace is being rewritten. Any calls to this function will result in an
+ * error.
+ */
int
dt_ioctl(dtrace_hdl_t *dtp, unsigned long int val, void *arg)
{
- const dtrace_vector_t *v = dtp->dt_vector;
-
- if (v != NULL)
- return (v->dtv_ioctl(dtp->dt_varg, val, arg));
-
- if (dtp->dt_fd >= 0)
- return (ioctl(dtp->dt_fd, val, arg));
-
errno = EBADF;
return (-1);
}
--
2.26.0
More information about the DTrace-devel
mailing list