USDT probes need provider spec ending with 0-9 or *
PATCH 1/2 USDT probes need provider spec ending with 0-9 or *
From: Eugene Loh <[email protected]>
We can avoid the globbing when the provider name is inconsistent with any USDT probe.
Signed-off-by Eugene Loh <[email protected]>
--- libdtrace/dt_pid.c | 8 ++++++++ 1 file changed, 8 insertions(+)
libdtrace/dt_pid.c +8 -0
@@ -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 ];
Signature · 1 line
2.43.5
PATCH 2/2 Fix prid fencepost errors
From: Eugene Loh <[email protected]>
Signed-off-by Eugene Loh <[email protected]>
--- libdtrace/dt_consume.c | 2 +- libdtrace/dt_handle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libdtrace/dt_consume.c +1 -1
@@ -2205,7 +2205,7 @@ dt_consume_one_probe(dtrace_hdl_t *dtp, FILE *fp, char *data, uint32_t size, pdat->dtpda_stid = stid; pdat->dtpda_data = data; -if (prid > dtp->dt_probe_id) +if (prid >= dtp->dt_probe_id)return dt_set_errno (dtp,EDT_BADID ); pdat->dtpda_pdesc = (dtrace_probedesc_t *)dtp->dt_probes[prid]->desc;if (dt_stid_lookup (dtp, stid, &pdat->dtpda_ddesc) !=0 )
libdtrace/dt_handle.c +1 -1
@@ -148,7 +148,7 @@ dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data) prid =DT_REC (uint64_t,0 ); stid =DT_REC (uint64_t,1 ); -if (prid > dtp->dt_probe_id) +if (prid >= dtp->dt_probe_id)return dt_set_errno (dtp,EDT_BADERROR );if (dt_stid_lookup (dtp, stid, &errdd) !=0 )return dt_set_errno (dtp,EDT_BADERROR );
Signature · 1 line
2.43.5
Re: [PATCH 2/2] Fix prid fencepost errors
Quoted 3 lines · On Wed, Oct 09, 2024 at 06:30:35PM -0400, [email protected] wrote:
From: Eugene Loh <[email protected]>
Signed-off-by Eugene Loh <[email protected]>
Reviewed-by Kris Van Hees <[email protected]>
Quoted 34 lines
--- libdtrace/dt_consume.c | 2 +- libdtrace/dt_handle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)libdtrace/dt_consume.c +1
-1@@ -2205,7 +2205,7 @@ dt_consume_one_probe(dtrace_hdl_t *dtp, FILE *fp, char *data, uint32_t size, pdat->dtpda_stid = stid; pdat->dtpda_data = data; -if (prid > dtp->dt_probe_id) +if (prid >= dtp->dt_probe_id)return dt_set_errno (dtp,EDT_BADID ); pdat->dtpda_pdesc = (dtrace_probedesc_t *)dtp->dt_probes[prid]->desc;if (dt_stid_lookup (dtp, stid, &pdat->dtpda_ddesc) !=0 )libdtrace/dt_handle.c +1
-1@@ -148,7 +148,7 @@ dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data) prid =DT_REC (uint64_t,0 ); stid =DT_REC (uint64_t,1 ); -if (prid > dtp->dt_probe_id) +if (prid >= dtp->dt_probe_id)return dt_set_errno (dtp,EDT_BADERROR );if (dt_stid_lookup (dtp, stid, &errdd) !=0 )return dt_set_errno (dtp,EDT_BADERROR );Signature · 1 line
2.43.5
Quoted 6 lines · On Wed, Oct 09, 2024 at 06:30:34PM -0400, [email protected] wrote:
From: Eugene Loh <[email protected]>
We can avoid the globbing when the provider name is inconsistent with any USDT probe.
Signed-off-by Eugene Loh <[email protected]>
Reviewed-by Kris Van Hees <[email protected]>
Quoted 26 lines
--- libdtrace/dt_pid.c | 8 ++++++++ 1 file changed, 8 insertions(+)libdtrace/dt_pid.c +8
-0@@ -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 ];Signature · 1 line
2.43.5