[DTrace-devel] [PATCH 1/5] Change use of dtrace_probe_iter()

Kris Van Hees kris.van.hees at oracle.com
Fri Jun 12 16:55:06 PDT 2020


On Thu, Jun 11, 2020 at 05:29:37PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> In DTrace v1, dtrace_probe_iter() was used to iterate over probes,
> using dt_probe_iter() as a callback function.
> 
> In the current release, dtrace_probe_iter() will be used as an external
> API, with dt_probe_iter() the "internal" (to libdtrace) interface.

I am not against this patch but I also do not see the need for it.  It is not
wrong for libdtrace code to use dtrace_probe_iter.  My intent was that the code
that uses dtrace_probe_iter would continue to use it, and only have direct
calls to dt_probe_iter done for cases where we need the callback function to
have access to the actual dt_probe_t (not exported) and not just the
dtrace_probedesc_t (exported).

Maybe you should look at whether using the dt_probe_f callback variant in this
case would benefit the rest of the code?  E.g. you don't need to do a provider
lookup (by name) since there is a pointer to the provider in dt_probe_t.

> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  libdtrace/dt_probe.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libdtrace/dt_probe.c b/libdtrace/dt_probe.c
> index b6c79354..7fa6c341 100644
> --- a/libdtrace/dt_probe.c
> +++ b/libdtrace/dt_probe.c
> @@ -989,14 +989,14 @@ dt_probe_info(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp,
>  	pd.id = DTRACE_IDNONE;
>  
>  	/*
> -	 * Call dtrace_probe_iter() to find matching probes.  Our
> +	 * Call dt_probe_iter() to find matching probes.  Our
>  	 * dt_probe_desc() callback will produce the following results:
>  	 *
> -	 * m < 0 dtrace_probe_iter() found zero matches (or failed).
> -	 * m > 0 dtrace_probe_iter() found more than one match.
> -	 * m = 0 dtrace_probe_iter() found exactly one match.
> +	 * m < 0 dt_probe_iter() found zero matches (or failed).
> +	 * m > 0 dt_probe_iter() found more than one match.
> +	 * m = 0 dt_probe_iter() found exactly one match.
>  	 */
> -	if ((m = dtrace_probe_iter(dtp, pdp, dt_probe_desc, &pd)) < 0)
> +	if ((m = dt_probe_iter(dtp, pdp, NULL, dt_probe_desc, &pd)) < 0)
>  		return NULL; /* dt_errno is set for us */
>  
>  	if ((pvp = dt_provider_lookup(dtp, pd.prv)) == NULL)
> -- 
> 2.18.2
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list