[DTrace-devel] [PATCH] options, test: correct bufsize calculations and tests

Eugene Loh eugene.loh at oracle.com
Thu Sep 19 20:39:26 UTC 2024


As we have discussed, I do not see the point of such a check.  We change 
the user-supplied value anyhow;  so why should we check it?  How about 
we come to a decision about what to do about this auto resizing stuff 
(which we've changed since legacy DTrace) before fine-tuning what we're 
checking.  (FWIW, I vote for no resizing.  The user typically has no 
need to specify a size.  If they do, we cannot guess if they want their 
size to be a min, max, or what.)

Also...

On 9/19/24 08:54, Kris Van Hees wrote:
> Reported-by: Eugene Loh <eugene.loh at oracle.com>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_work.c                 |  9 +++------
>   test/unittest/options/tst.b.d       | 19 ++++++++++---------
>   test/unittest/options/tst.bufsize.d | 19 ++++++++++---------
>   3 files changed, 23 insertions(+), 24 deletions(-)

What about the "too low" tests?

> diff --git a/libdtrace/dt_work.c b/libdtrace/dt_work.c
> @@ -268,15 +268,12 @@ dtrace_go(dtrace_hdl_t *dtp, uint_t cflags)
>   	dtrace_getopt(dtp, "bufsize", &size);
>   	if (size == 0 ||
> -	    size < sizeof(struct perf_event_header) + sizeof(uint32_t) +
> -		   dtp->dt_maxreclen)
> +	    size < sizeof(struct perf_event_header) + dtp->dt_maxreclen)
>   		return dt_set_errno(dtp, EDT_BUFTOOSMALL);
>   	if (dt_pebs_init(dtp, size) == -1)
>   		return dt_set_errno(dtp, EDT_NOMEM);

Why does the code special-case "size == 0"?



More information about the DTrace-devel mailing list