Skip to content

Commit

Permalink
Pass pid explicitly to dtrace provider's uprobe_spec
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Jan 23, 2024
1 parent 2355f1a commit 197061c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libdtrace/dt_prov_dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
return 0;
}

static char *uprobe_spec(const char *prb)
static char *uprobe_spec(pid_t pid, const char *prb)
{
struct ps_prochandle *P;
int perr = 0;
Expand All @@ -178,8 +178,8 @@ static char *uprobe_spec(const char *prb)
if (asprintf(&fun, "%s%s", prb, PROBE_FUNC_SUFFIX) < 0)
return NULL;

/* grab our process */
P = Pgrab(getpid(), 2, 0, NULL, &perr);
/* grab the process */
P = Pgrab(pid, 2, 0, NULL, &perr);
if (P == NULL) {
free(fun);
return NULL;
Expand Down Expand Up @@ -208,7 +208,7 @@ static int attach(dtrace_hdl_t *dtp, const dt_probe_t *prp, int bpf_fd)
int fd, rc = -1;

/* get a uprobe specification for this probe */
spec = uprobe_spec(prp->desc->prb);
spec = uprobe_spec(getpid(), prp->desc->prb);
if (spec == NULL)
return -ENOENT;

Expand Down

0 comments on commit 197061c

Please sign in to comment.