[DTrace-devel] [PATCH 06/19] Allow for USDT wildcards

eugene.loh at oracle.com eugene.loh at oracle.com
Thu Aug 29 05:25:45 UTC 2024


From: Eugene Loh <eugene.loh at oracle.com>

To look for pid probes, 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 '*'.

So expand the criteria appropriately.
---
 libdtrace/dt_cc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
index cfd4d3d1..a9934d10 100644
--- a/libdtrace/dt_cc.c
+++ b/libdtrace/dt_cc.c
@@ -278,8 +278,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) != 0) {
-- 
2.43.5




More information about the DTrace-devel mailing list