[DTrace-devel] [PATCH] Fix type of default key when creating BPF maps

Eugene Loh eugene.loh at oracle.com
Thu Dec 9 05:26:34 UTC 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

s/vlaue/value/

And some traditional English teacher somewhere would prefer s/to 
just/just to/.

On 12/9/21 12:04 AM, Kris Van Hees via DTrace-devel wrote:
> The default key (0) used to populate various BPF maps was declared as
> uint32_t. but the 'dvars' BPF map uses a uint64_t key.  Since we know
> that the vlaue of the key will always be 0, it is safe to just make it
> uint64_t for all maps, and have it be interpreted as uint32_t for the
> maps that use a smaller key size.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_bpf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> index ccfd7f09..50343057 100644
> --- a/libdtrace/dt_bpf.c
> +++ b/libdtrace/dt_bpf.c
> @@ -227,7 +227,7 @@ dt_bpf_gmap_create(dtrace_hdl_t *dtp)
>   	int		stabsz, gvarsz, lvarsz, aggsz, memsz;
>   	int		dvarc = 0;
>   	int		ci_mapfd, st_mapfd, pr_mapfd;
> -	uint32_t	key = 0;
> +	uint64_t	key = 0;
>   	size_t		strsize = dtp->dt_options[DTRACEOPT_STRSIZE];
>   	uint8_t		*buf, *end;
>   	char		*strtab;



More information about the DTrace-devel mailing list