[DTrace-devel] [PATCH 2/5] cmd: report lowered/raised buffer sizes correctly

Eugene Loh eugene.loh at oracle.com
Mon May 1 22:09:58 UTC 2023


On 5/1/23 15:48, Kris Van Hees via DTrace-devel wrote:

> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   cmd/dtrace.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/dtrace.c b/cmd/dtrace.c
> index e7ca9e4c..fe771740 100644
> --- a/cmd/dtrace.c
> +++ b/cmd/dtrace.c
> @@ -833,8 +833,9 @@ go(void)
>   		return;
>   
>   	for (i = 0; bufs[i].name != NULL; i++) {
> -		dtrace_optval_t j = 0, mul = 10;
> -		dtrace_optval_t nsize;
> +		dtrace_optval_t	j = 0, mul = 10;
> +		dtrace_optval_t	nsize;
> +		char		*dir;
>   
>   		if (bufs[i].val == DTRACEOPT_UNSET)
>   			continue;
> @@ -844,14 +845,16 @@ go(void)
>   		if (nsize == DTRACEOPT_UNSET || nsize == 0)
>   			continue;
>   
> -		if (nsize >= bufs[i].val - sizeof(uint64_t))
> +		if (nsize == bufs[i].val)
>   			continue;
>   
> +		dir = nsize > bufs[i].val ? "raised" : "lowered";
> +
>   		for (; (INT64_C(1) << mul) <= nsize; j++, mul += 10)
>   			continue;
>   
>   		if (!(nsize & ((INT64_C(1) << (mul - 10)) - 1))) {
> -			error("%s lowered to %lld%c\n", bufs[i].name,
> +			error("%s %s to %lld%c\n", bufs[i].name, dir,
>   			    (long long)nsize >> (mul - 10), " kmgtpe"[j]);
>   		} else {
>   			error("%s lowered to %lld bytes\n", bufs[i].name,

Shouldn't the same change be made to the else branch?

Also, shouldn't there be test changes?  Some .r files need to be updated 
or new tests created?



More information about the DTrace-devel mailing list