[DTrace-devel] [PATCH 14/16] Only perform detach if the probe is attached
Eugene Loh
eugene.loh at oracle.com
Fri Mar 26 12:02:48 PDT 2021
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Minor comments below.
On 3/19/21 12:54 AM, Kris Van Hees wrote:
> diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
> @@ -308,7 +308,11 @@ static int probe_info(dtrace_hdl_t *dtp, const dt_probe_t *prp,
> */
> static void detach(dtrace_hdl_t *dtp, const dt_probe_t *prp)
> {
> - int fd;
> + int fd;
> + tp_probe_t *tpp = prp->prv_data;
> +
> + if (!dt_tp_is_attached(tpp))
> + return;
>
> dt_tp_detach(dtp, prp->prv_data);
At this point, prp->prv_data can become tpp, which is both simpler and
mimics what you do in fbt.
> diff --git a/libdtrace/dt_prov_fbt.c b/libdtrace/dt_prov_fbt.c
> @@ -267,9 +267,13 @@ static int probe_info(dtrace_hdl_t *dtp, const dt_probe_t *prp,
> */
> static void detach(dtrace_hdl_t *dtp, const dt_probe_t *prp)
> {
> - int fd;
> + tp_probe_t *tpp = prp->prv_data;
> + int fd;
In dtrace, you declare fd then tpp. In fbt, you have tpp then fd. Might
as well use the same order both times.
More information about the DTrace-devel
mailing list