Re: [PATCH bpf-next v1 5/7] tools: bpftool: support loading map by fd from parent process

From: Quentin Monnet
Date: Wed Mar 20 2019 - 15:05:16 EST


2019-03-20 18:33 UTC+0100 ~ Alban Crequy <alban.crequy@xxxxxxxxx>
> From: Alban Crequy <alban@xxxxxxxxxx>
>
> Using a file descriptor passed by the parent process enables
> applications to fork a bpftool command to inspect a map they know by
> file descriptor even when they don't support bpffs or map ids.
>
> Documentation and bash completion updated as well.
>
> Signed-off-by: Alban Crequy <alban@xxxxxxxxxx>
> ---
> tools/bpf/bpftool/Documentation/bpftool-map.rst | 8 ++++++++
> tools/bpf/bpftool/bash-completion/bpftool | 10 +++++-----
> tools/bpf/bpftool/map.c | 13 +++++++++++++
> 3 files changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-map.rst b/tools/bpf/bpftool/Documentation/bpftool-map.rst
> index dfd8352fa453..658fe2fb8ecf 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-map.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-map.rst
> @@ -265,6 +265,14 @@ would be lost as soon as bpftool exits).
>
> anon_inode:bpf-map
>
> +**# bpftool map exec pinned /sys/fs/bpf/foo fd 99 cmd -- bpftool map show fd 99**
> +
> +::
> +
> + 10: hash name some_map flags 0x0
> + key 4B value 8B max_entries 2048 memlock 167936B
> +
> +

Could you please also update the description of the command higher in
that page, and in the interactive help?