From: Kris Van Hees <kris.van.hees@oracle.com>
To: eugene.loh@oracle.com
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 1/4] Rename _DTRACE_VERSION
Date: Thu, 27 Feb 2025 11:27:30 -0500 [thread overview]
Message-ID: <Z8CScii3+at2Chzu@oracle.com> (raw)
In-Reply-To: <20250208190622.23484-1-eugene.loh@oracle.com>
On Sat, Feb 08, 2025 at 02:06:19PM -0500, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> There are many DTrace version numbers (for version, API version,
> package version, etc.). Meanwhile, _DTRACE_VERSION is not a
> version number at all. It's a preprocessor macro in USDT .h header
> files. Prior to commit e2fb0ecd9
> ("Ensure multiple passes through dtrace -G work."), it was perhaps
> not even set. With that commit, it was always set to 1, with
> the rationale:
>
> Also add an explicit define for _DTRACE__VERSION in the generated
> header file from 'dtrace -h' invocations. This seems silly, but
> it is there to give people a skeleton to work with if they want to
> pre-generate header files and select whether to actually compile
> on the probes at a later time.
>
> Rename to _DTRACE_HEADER for better clarity. Define it only once
> per file.
Based on the rationale, I would think that something like _DTRACE_USE_USDT
or somethng similar would be better? Since the purpose seems to be to allow
(after the header file is generated) for someone to change that 1 to 0 to
disable the USDT probes to be compiled in.
In fact, if we want to support this in a more developer-friendly way, we
might as well change the generted line to be more like:
#ifndef _DTRACE_USE_USDT
# define _DTARCE_USE_USDT 1
#endif
so that a package could e.g. allow a configure option or something to set it
to 1 or 0, dypassing the need to manually change the file.
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> ---
> libdtrace/dt_program.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libdtrace/dt_program.c b/libdtrace/dt_program.c
> index 23b91fb2e..c6fdafb47 100644
> --- a/libdtrace/dt_program.c
> +++ b/libdtrace/dt_program.c
> @@ -505,13 +505,12 @@ dt_header_provider(dtrace_hdl_t *dtp, dt_provider_t *pvp, FILE *out)
> info.dthi_pfname = alloca(strlen(pvp->desc.dtvd_name) + 1 + i);
> dt_header_fmt_func(info.dthi_pfname, pvp->desc.dtvd_name);
>
> - if (fprintf(out, "#define _DTRACE_VERSION 1\n\n"
> - "#if _DTRACE_VERSION\n\n") < 0)
> + if (fprintf(out, "#if _DTRACE_HEADER\n\n") < 0)
> return dt_set_errno(dtp, errno);
>
> if (dt_idhash_iter(pvp->pv_probes, dt_header_probe, &info) != 0)
> return -1; /* dt_errno is set for us */
> - if (fprintf(out, "\n\n") < 0)
> + if (fprintf(out, "\n") < 0)
> return dt_set_errno(dtp, errno);
> if (dt_idhash_iter(pvp->pv_probes, dt_header_decl, &info) != 0)
> return -1; /* dt_errno is set for us */
> @@ -560,6 +559,9 @@ dtrace_program_header(dtrace_hdl_t *dtp, FILE *out, const char *fname)
> "#endif\n\n") < 0)
> return -1;
>
> + if (fprintf(out, "#define _DTRACE_HEADER 1\n\n") < 0)
> + return -1;
> +
> while ((pvp = dt_htab_next(dtp->dt_provs, &it)) != NULL) {
> if (dt_header_provider(dtp, pvp, out) != 0) {
> dt_htab_next_destroy(it);
> --
> 2.43.5
>
prev parent reply other threads:[~2025-02-27 16:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 19:06 [PATCH 1/4] Rename _DTRACE_VERSION eugene.loh
2025-02-08 19:06 ` [PATCH 2/4] Eliminate DT_VERS_LATEST eugene.loh
2025-02-27 16:40 ` Kris Van Hees
2025-02-27 16:57 ` [DTrace-devel] " Kris Van Hees
2025-02-28 3:19 ` Kris Van Hees
2025-02-08 19:06 ` [PATCH 3/4] Sync up the version numbers eugene.loh
2025-02-08 19:06 ` [PATCH 4/4] test: Add test for predefined preprocessor definitions eugene.loh
2025-03-18 19:18 ` Kris Van Hees
2025-03-18 20:35 ` Eugene Loh
2025-03-18 20:42 ` Kris Van Hees
2025-02-27 16:27 ` Kris Van Hees [this message]
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=Z8CScii3+at2Chzu@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=eugene.loh@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