[DTrace-devel] [PATCH 1/2] USDT probes need provider spec ending with 0-9 or *

Kris Van Hees kris.van.hees at oracle.com
Tue Oct 29 15:37:24 UTC 2024


On Wed, Oct 09, 2024 at 06:30:34PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> We can avoid the globbing when the provider name is inconsistent
> with any USDT probe.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  libdtrace/dt_pid.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
> index 62060b592..3f9e3052b 100644
> --- a/libdtrace/dt_pid.c
> +++ b/libdtrace/dt_pid.c
> @@ -1151,6 +1151,14 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *
>  
>  	assert(pcb != NULL);
>  
> +	/* If it cannot end with a pid, we're done. */
> +	if (pdp->prv[0] != '\0') {
> +		char lastchar = pdp->prv[strlen(pdp->prv) - 1];
> +
> +		if (lastchar != '*' && !isdigit(lastchar))
> +			return 0;
> +	}
> +
>  	/* If it's strictly a pid provider, we're done. */
>  	if (strncmp(pdp->prv, "pid", 3) == 0 && isdigit(pdp->prv[3])) {
>  		const char *p = &pdp->prv[4];
> -- 
> 2.43.5
> 



More information about the DTrace-devel mailing list