[DTrace-devel] [PATCH 14/17] dof: don't emit providers with no probes

Nick Alcock nick.alcock at oracle.com
Wed Aug 10 22:07:06 UTC 2022


Without this, you end up with DOF with a lot of zero-probe providers
in.  This not only wastes space but causes the DOF to fail validation
(arguably unnecessarily, but why waste the space in the first place?)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 libdtrace/dt_dof.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libdtrace/dt_dof.c b/libdtrace/dt_dof.c
index 947d47e58897..7cf2ac9512dc 100644
--- a/libdtrace/dt_dof.c
+++ b/libdtrace/dt_dof.c
@@ -426,6 +426,9 @@ dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
 	if (pvp->pv_flags & DT_PROVIDER_IMPL)
 		return; /* ignore providers that are exported by dtrace(7D) */
 
+	if (dt_idhash_size(pvp->pv_probes) == 0)
+		return;	/* don't emit providers with no probes */
+
 	nxr = dt_popcb(pvp->pv_xrefs, pvp->pv_xrmax);
 	dofs = alloca(sizeof(dof_secidx_t) * (nxr + 1));
 	xr = 1; /* reserve dofs[0] for the provider itself */
-- 
2.37.1.265.g363c192786.dirty




More information about the DTrace-devel mailing list