[DTrace-devel] [PATCH v2 15/20] dof: don't emit providers with no probes

Nick Alcock nick.alcock at oracle.com
Wed Sep 7 13:00:02 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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_dof.c b/libdtrace/dt_dof.c
index 947d47e58897..be29f0451e50 100644
--- a/libdtrace/dt_dof.c
+++ b/libdtrace/dt_dof.c
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  */
@@ -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