[DTrace-devel] [PATCH v3 11/19] Support USDT wildcard provider descriptions

Kris Van Hees kris.van.hees at oracle.com
Thu Oct 24 16:38:26 UTC 2024


On Tue, Sep 24, 2024 at 04:25:52PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> To look for pid probes, whose pid values must be specified explicitly,
> we can require that the provider description should end in a digit.
> 
> For USDT probes, however, there can be wildcard descriptions.  This
> includes a blank provider description as well as a description that
> ends in an '*'.

What about 'test*1234' or 'test*12*' or 'test*1*2*4'?  All should match
'test_prov1234', right?

> So, in dt_setcontext(), expand the criteria appropriately.  And
> modify dt_pid_create_probes() accordingly.
> 
> This is rudimentary support.  We still need to:
> - handle globs in dt_pid_create_probes_module()
> - add process monitoring / inotify
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  libdtrace/dt_cc.c                                       | 5 +++--
>  test/unittest/dtrace-util/tst.ListProbesFuncUSDT.sh     | 1 -
>  test/unittest/dtrace-util/tst.ListProbesModuleUSDT.sh   | 1 -
>  test/unittest/dtrace-util/tst.ListProbesNameUSDT.sh     | 1 -
>  test/unittest/dtrace-util/tst.ListProbesProviderUSDT.sh | 1 -
>  test/unittest/usdt/tst.forker.sh                        | 1 -
>  6 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
> index 12104fc21..62482a70f 100644
> --- a/libdtrace/dt_cc.c
> +++ b/libdtrace/dt_cc.c
> @@ -273,8 +273,9 @@ dt_setcontext(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp)
>  	 * On an error, dt_pid_create_probes() will set the error message
>  	 * and tag -- we just have to longjmp() out of here.
>  	 */
> -	if (pdp->prv && pdp->prv[0] &&
> -	    isdigit(pdp->prv[strlen(pdp->prv) - 1]) &&
> +	if (pdp->prv &&
> +	    (pdp->prv[0] == '\0' || isdigit(pdp->prv[strlen(pdp->prv) - 1]) ||
> +	             pdp->prv[strlen(pdp->prv) - 1] == '*') &&
>  	    ((pvp = dt_provider_lookup(dtp, pdp->prv)) == NULL ||
>  	     pvp->pv_flags & DT_PROVIDER_PID) &&
>  	    dt_pid_create_probes((dtrace_probedesc_t *)pdp, dtp, yypcb) != 0) {

First of all, I am not sure that combining pid and USDT probe handling here
by means of dt_pid_create_probes() makes sense under the new scheme.  In fact,
dt_pid_create_probes() may no longer be needed because handling them separately
seems better.

Then there are two cases:

 - For pid probes, a provider name must have been supplied and it must have a
   digit as last character.  So, for pid probes you can keep the original code
   aside from replacing dt_pid_create_probes() with dt_pid_create_pid_probes().

 - For USDT probes, there aren't any restrictions, other than the ones already
   done in dt_pid_create_usdt_probes().  So, a call to that function should be
   done here without any conditional.

> diff --git a/test/unittest/dtrace-util/tst.ListProbesFuncUSDT.sh b/test/unittest/dtrace-util/tst.ListProbesFuncUSDT.sh
> index bd0552dca..99ae995eb 100755
> --- a/test/unittest/dtrace-util/tst.ListProbesFuncUSDT.sh
> +++ b/test/unittest/dtrace-util/tst.ListProbesFuncUSDT.sh
> @@ -5,7 +5,6 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> -# @@xfail: dtv2
>  
>  ##
>  #
> diff --git a/test/unittest/dtrace-util/tst.ListProbesModuleUSDT.sh b/test/unittest/dtrace-util/tst.ListProbesModuleUSDT.sh
> index 7b9c6a5fc..5ae087fbf 100755
> --- a/test/unittest/dtrace-util/tst.ListProbesModuleUSDT.sh
> +++ b/test/unittest/dtrace-util/tst.ListProbesModuleUSDT.sh
> @@ -5,7 +5,6 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> -# @@xfail: dtv2
>  
>  ##
>  #
> diff --git a/test/unittest/dtrace-util/tst.ListProbesNameUSDT.sh b/test/unittest/dtrace-util/tst.ListProbesNameUSDT.sh
> index f9b1d8bf8..5c0509d89 100755
> --- a/test/unittest/dtrace-util/tst.ListProbesNameUSDT.sh
> +++ b/test/unittest/dtrace-util/tst.ListProbesNameUSDT.sh
> @@ -5,7 +5,6 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> -# @@xfail: dtv2
>  
>  ##
>  #
> diff --git a/test/unittest/dtrace-util/tst.ListProbesProviderUSDT.sh b/test/unittest/dtrace-util/tst.ListProbesProviderUSDT.sh
> index 644da2ac2..6eae82ed9 100755
> --- a/test/unittest/dtrace-util/tst.ListProbesProviderUSDT.sh
> +++ b/test/unittest/dtrace-util/tst.ListProbesProviderUSDT.sh
> @@ -5,7 +5,6 @@
>  # Licensed under the Universal Permissive License v 1.0 as shown at
>  # http://oss.oracle.com/licenses/upl.
>  #
> -# @@xfail: dtv2
>  
>  ##
>  #
> diff --git a/test/unittest/usdt/tst.forker.sh b/test/unittest/usdt/tst.forker.sh
> index 7cfa9eb5f..92513eb5d 100755
> --- a/test/unittest/usdt/tst.forker.sh
> +++ b/test/unittest/usdt/tst.forker.sh
> @@ -7,7 +7,6 @@
>  #
>  #
>  # @@timeout: 120
> -# @@xfail: dtv2 USDT wildcard
>  
>  if [ $# != 1 ]; then
>  	echo expected one argument: '<'dtrace-path'>'
> -- 
> 2.43.5
> 



More information about the DTrace-devel mailing list