Skip to content

Commit

Permalink
dof: don't emit providers with no probes
Browse files Browse the repository at this point in the history
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@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Oct 25, 2022
1 parent d7fbbd8 commit 1a21c9b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libdtrace/dt_dof.c
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 1a21c9b

Please sign in to comment.