• Quentin Monnet's avatar
    bpftool: Switch to libbpf's hashmap for PIDs/names references · d6699f8e
    Quentin Monnet authored
    In order to show PIDs and names for processes holding references to BPF
    programs, maps, links, or BTF objects, bpftool creates hash maps to
    store all relevant information. This commit is part of a set that
    transitions from the kernel's hash map implementation to the one coming
    with libbpf.
    
    The motivation is to make bpftool less dependent of kernel headers, to
    ease the path to a potential out-of-tree mirror, like libbpf has.
    
    This is the third and final step of the transition, in which we convert
    the hash maps used for storing the information about the processes
    holding references to BPF objects (programs, maps, links, BTF), and at
    last we drop the inclusion of tools/include/linux/hashtable.h.
    
    Note: Checkpatch complains about the use of __weak declarations, and the
    missing empty lines after the bunch of empty function declarations when
    compiling without the BPF skeletons (none of these were introduced in
    this patch). We want to keep things as they are, and the reports should
    be safe to ignore.
    Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20211023205154.6710-6-quentin@isovalent.com
    d6699f8e
btf.c 22.1 KB