public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH v2 05/14] probe: improve dt_probe_lookup2()
Date: Tue, 29 Oct 2024 21:57:59 +0000	[thread overview]
Message-ID: <87plnio9lk.fsf@esperi.org.uk> (raw)
In-Reply-To: <ZyE8jj3mle7c9NKl@oracle.com> (Kris Van Hees's message of "Tue, 29 Oct 2024 15:50:38 -0400")

On 29 Oct 2024, Kris Van Hees outgrape:

> On Mon, Oct 28, 2024 at 09:17:54PM +0000, Nick Alcock via DTrace-devel wrote:
>> diff --git a/libdtrace/dt_impl.h b/libdtrace/dt_impl.h
>> index 340dc1960c5e..d11ad2839f8e 100644
>> --- a/libdtrace/dt_impl.h
>> +++ b/libdtrace/dt_impl.h
>> @@ -759,6 +759,8 @@ extern dtrace_difo_t *dt_difo_copy(dtrace_hdl_t *dtp, const dtrace_difo_t *odp);
>>  extern int dt_consume_init(dtrace_hdl_t *);
>>  extern void dt_consume_fini(dtrace_hdl_t *);
>>  
>> +extern void dt_desc_destroy(dtrace_hdl_t *dtp, dtrace_probedesc_t *);
>
> I think it would be better to let dt_desc_destroy() take a third arg, to
> indicate whether the desc itself should be free'd as well or whether it
> should be left alone.
>
> That avoids calling it and then following it up with a dt_free() on the desc.

... er, OK? Is that really clearer than the alternative?

Implemented, anyway (and made it return straight away if called with a
NULL pdp, for consistency with free(), which lets us drop a conditional
as well).

>> diff --git a/libdtrace/dt_subr.c b/libdtrace/dt_subr.c
>> index d6aad7637fb9..72631b33a0ad 100644
>> --- a/libdtrace/dt_subr.c
>> +++ b/libdtrace/dt_subr.c
>> @@ -175,6 +175,16 @@ dtrace_desc2str(const dtrace_probedesc_t *pdp, char *buf, size_t len)
>>  	return buf;
>>  }
>>  
>> +/* Only use on probedescs derived from dtrace_xstr2desc above. */
>
> Why can't it used on other dtrace_probedesc_t that contain references to
> memory that needs to be free'd?  I don't think that dtrace_xstr2desc() does
> anything to make the desc it populates be special.

I'm a bit worried that some of them might be using pointers to regions
within storage owned by someone else rather than strdup()s (I mean they
*are* const, and that's what that generally means). If that's not true,
why are the pointers const?

-- 
NULL && (void)

  reply	other threads:[~2024-10-29 21:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28 21:17 [PATCH v2 00/14] gentoo, manpage, and assorted other small fixes Nick Alcock
2024-10-28 21:17 ` [PATCH v2 01/14] No longer depend on libsystemd Nick Alcock
2024-10-29 18:27   ` Kris Van Hees
2024-10-29 21:51     ` Nick Alcock
2024-10-28 21:17 ` [PATCH v2 02/14] pkgconfig: drop spaces in variable decls Nick Alcock
2024-10-28 21:17 ` [PATCH v2 03/14] configure, build: make valgrind optional Nick Alcock
2024-10-28 21:17 ` [PATCH v2 04/14] build: substitute LIBDIR in pkg-config files Nick Alcock
2024-10-28 21:17 ` [PATCH v2 05/14] probe: improve dt_probe_lookup2() Nick Alcock
2024-10-29 19:50   ` [DTrace-devel] " Kris Van Hees
2024-10-29 21:57     ` Nick Alcock [this message]
2024-10-28 21:17 ` [PATCH v2 06/14] configure: fix dreadful behaviour of MANDIR / --mandir Nick Alcock
2024-10-28 21:17 ` [PATCH v2 07/14] man: the synopsis is ended with .YS, not .SY Nick Alcock
2024-10-28 21:17 ` [PATCH v2 08/14] man: use \- for option dashes, not - Nick Alcock
2024-10-28 21:17 ` [PATCH v2 09/14] man: drop blank lines Nick Alcock
2024-10-28 21:17 ` [PATCH v2 10/14] man: fix blank line in environment variables list Nick Alcock
2024-10-28 21:18 ` [PATCH v2 11/14] dtprobed: fix parser child timeout Nick Alcock
2024-10-28 21:18 ` [PATCH v2 12/14] man: add manpage for dtprobed(8) Nick Alcock
2024-10-29 21:19   ` Kris Van Hees
2024-10-28 21:18 ` [PATCH v2 13/14] man: drop double-\fB at the start of every option line Nick Alcock
2024-10-28 21:18 ` [PATCH v2 14/14] man: \fP-ize Nick Alcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plnio9lk.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=kris.van.hees@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox