[DTrace-devel] [PATCH 18/38] Add a provider-specific probe_add_clause for underlying probes
Eugene Loh
eugene.loh at oracle.com
Fri Jul 19 04:00:44 UTC 2024
Patch withdrawn. Its contents will be squashed into a new "v2 16/38"
with a modified subject line.
On 7/18/24 16:50, Kris Van Hees wrote:
> See comments in 16/38
>
> On Thu, Jun 27, 2024 at 01:34:35AM -0400, eugene.loh at oracle.com wrote:
>> From: Eugene Loh <eugene.loh at oracle.com>
>>
>> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
>> ---
>> libdtrace/dt_prov_uprobe.c | 34 ++++++++++++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>>
>> diff --git a/libdtrace/dt_prov_uprobe.c b/libdtrace/dt_prov_uprobe.c
>> index c77063a8..5dbd75e3 100644
>> --- a/libdtrace/dt_prov_uprobe.c
>> +++ b/libdtrace/dt_prov_uprobe.c
>> @@ -129,6 +129,38 @@ static void probe_destroy(dtrace_hdl_t *dtp, void *datap)
>> free_probe_list(dtp, datap);
>> }
>>
>> +/*
>> + * Add clause to probe.
>> + */
>> +static int probe_add_clause(dtrace_hdl_t *dtp, dt_probe_t *prp, dt_ident_t *idp)
>> +{
>> + const list_probe_t *pup;
>> +
>> + for (pup = prp->prv_data; pup != NULL; pup = dt_list_next(pup)) {
>> + dt_probe_t *uprp = pup->probe;
>> + dt_probe_clause_t *prev, *pcp;
>> +
>> + /*
>> + * Check if the clause is already there. Since the clauses
>> + * are added "in order," we only need to check the previous
>> + * entry.
>> + */
>> + prev = dt_list_prev(&uprp->clauses);
>> + if (prev && strcmp(prev->clause->di_name, idp->di_name) == 0)
>> + continue;
>> +
>> + /*
>> + * Add the clause.
>> + */
>> + pcp = dt_zalloc(dtp, sizeof(dt_probe_clause_t));
>> + if (pcp == NULL)
>> + return -1;
>> + pcp->clause = idp;
>> + dt_list_append(&uprp->clauses, pcp);
>> + }
>> +
>> + return 0;
>> +}
>>
>> /*
>> * Look up or create an underlying (real) probe, corresponding directly to a
>> @@ -811,6 +843,7 @@ dt_provimpl_t dt_pid = {
>> .prog_type = BPF_PROG_TYPE_UNSPEC,
>> .provide_probe = &provide_pid_probe,
>> .enable = &enable_pid,
>> + .probe_add_clause = &probe_add_clause,
>> .probe_destroy = &probe_destroy,
>> };
>>
>> @@ -822,5 +855,6 @@ dt_provimpl_t dt_usdt = {
>> .prog_type = BPF_PROG_TYPE_UNSPEC,
>> .provide_probe = &provide_usdt_probe,
>> .enable = &enable_usdt,
>> + .probe_add_clause = &probe_add_clause,
>> .probe_destroy = &probe_destroy,
>> };
>> --
>> 2.18.4
>>
More information about the DTrace-devel
mailing list