[DTrace-devel] [PATCH 2/4] providers: loop through all providers for discovery
Kris Van Hees
kris.van.hees at oracle.com
Thu May 1 15:08:18 UTC 2025
The discovery of probes was tied to the static list of providers that
are called on init. It should iterate over all providers that are in
fact registered, i.e. the dt_provs hash.
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
libdtrace/dt_provider.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libdtrace/dt_provider.c b/libdtrace/dt_provider.c
index 1e2e844e..06f0b039 100644
--- a/libdtrace/dt_provider.c
+++ b/libdtrace/dt_provider.c
@@ -176,11 +176,13 @@ dt_provider_xref(dtrace_hdl_t *dtp, dt_provider_t *pvp, id_t id)
int
dt_provider_discover(dtrace_hdl_t *dtp)
{
- int i, prid = dtp->dt_probe_id;
+ int prid = dtp->dt_probe_id;
+ dt_htab_next_t *it = NULL;
+ dt_provider_t *pvp;
/* Discover new probes. */
- for (i = 0; dt_providers[i]; i++) {
- if (dt_providers[i]->discover && dt_providers[i]->discover(dtp) < 0)
+ while ((pvp = dt_htab_next(dtp->dt_provs, &it)) != NULL) {
+ if (pvp->impl->discover && pvp->impl->discover(dtp) < 0)
return -1; /* errno is already set */
}
--
2.42.0
More information about the DTrace-devel
mailing list