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

Eugene Loh eugene.loh at oracle.com
Thu Sep 1 02:07:34 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Is there a failure you can illustrate by adding a test case?

On 8/10/22 18:07, Nick Alcock via DTrace-devel wrote:
> 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 */



More information about the DTrace-devel mailing list