Skip to contentSkip to conversation

Support USDT wildcard provider descriptions

PATCH Superseded [email protected] 1 participant 1 message Sep 17, 2024

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 11/19 Support USDT wildcard provider descriptions

From: Eugene Loh <[email protected]>

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 '*'.

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
- deal with FIXMEs

---
 libdtrace/dt_cc.c                             |  5 +-
 libdtrace/dt_pid.c                            | 76 +++++++++++++++----
 .../dtrace-util/tst.ListProbesFuncUSDT.sh     |  1 -
 .../dtrace-util/tst.ListProbesModuleUSDT.sh   |  1 -
 .../dtrace-util/tst.ListProbesNameUSDT.sh     |  1 -
 .../dtrace-util/tst.ListProbesProviderUSDT.sh |  1 -
 test/unittest/usdt/tst.forker.sh              |  1 -
 7 files changed, 63 insertions(+), 23 deletions(-)
libdtrace/dt_cc.c +3 -2
index 85352f46a..9884b28c2 100644
@@ -270,8 +270,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) {
libdtrace/dt_pid.c +60 -16

136 lines not on this page · raw message

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