[DTrace-devel] [PATCH v4 11/19] Support USDT wildcard provider descriptions
eugene.loh at oracle.com
eugene.loh at oracle.com
Fri Oct 25 06:34:22 UTC 2024
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 '*'.
So, get rid of dt_pid_create_probes(), replacing it with
dt_pid_create_pid_probes()
dt_pid_create_usdt_probes()
calling each one appropriately.
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 | 17 ++++++++++-------
libdtrace/dt_pid.c | 8 --------
libdtrace/dt_pid.h | 4 ++--
.../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 -
8 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
index fa16f8e5f..eebd923ce 100644
--- a/libdtrace/dt_cc.c
+++ b/libdtrace/dt_cc.c
@@ -262,24 +262,27 @@ dt_setcontext(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp)
int err;
/*
- * Both kernel and pid based providers are allowed to have names
- * ending with what could be interpreted as a number. We assume it's
- * a pid and that we may need to dynamically create probes for
- * that process if:
+ * A provider name ending in a digit could be for a pid provider.
+ * We may need to dynamically create probes for that process if:
*
* (1) The provider doesn't exist, or,
* (2) The provider exists and has DT_PROVIDER_PID flag set.
*
- * On an error, dt_pid_create_probes() will set the error message
+ * On an error, dt_pid_create_pid_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]) &&
((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) {
+ dt_pid_create_pid_probes((dtrace_probedesc_t *)pdp, dtp, yypcb) != 0)
+ longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+ /*
+ * USDT probes.
+ */
+ if (dt_pid_create_usdt_probes((dtrace_probedesc_t *)pdp, dtp, yypcb) != 0)
longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
- }
/*
* Call dt_probe_info() to get the probe arguments and attributes. If
diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 62060b592..35cf73ee8 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -1207,14 +1207,6 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *
return err ? -1 : 0;
}
-int
-dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
-{
- if (dt_pid_create_pid_probes(pdp, dtp, pcb))
- return -1;
- return dt_pid_create_usdt_probes(pdp, dtp, pcb);
-}
-
int
dt_pid_create_probes_module(dtrace_hdl_t *dtp, dt_proc_t *dpr)
{
diff --git a/libdtrace/dt_pid.h b/libdtrace/dt_pid.h
index 9277c6bc0..c35adc2c0 100644
--- a/libdtrace/dt_pid.h
+++ b/libdtrace/dt_pid.h
@@ -16,10 +16,10 @@
extern "C" {
#endif
+extern int dt_pid_create_pid_probes(dtrace_probedesc_t *, dtrace_hdl_t *,
+ dt_pcb_t *);
extern int dt_pid_create_usdt_probes(dtrace_probedesc_t *, dtrace_hdl_t *,
dt_pcb_t *);
-extern int dt_pid_create_probes(dtrace_probedesc_t *, dtrace_hdl_t *,
- dt_pcb_t *);
extern int dt_pid_create_probes_module(dtrace_hdl_t *, dt_proc_t *);
extern pid_t dt_pid_get_pid(const dtrace_probedesc_t *, dtrace_hdl_t *, dt_pcb_t *,
dt_proc_t *);
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