• Andrii Nakryiko's avatar
    bpftool: Add bpf_link show and pin support · c5481f9a
    Andrii Nakryiko authored
    Add `bpftool link show` and `bpftool link pin` commands.
    
    Example plain output for `link show` (with showing pinned paths):
    
    [vmuser@archvm bpf]$ sudo ~/local/linux/tools/bpf/bpftool/bpftool -f link
    1: tracing  prog 12
            prog_type tracing  attach_type fentry
            pinned /sys/fs/bpf/my_test_link
            pinned /sys/fs/bpf/my_test_link2
    2: tracing  prog 13
            prog_type tracing  attach_type fentry
    3: tracing  prog 14
            prog_type tracing  attach_type fentry
    4: tracing  prog 15
            prog_type tracing  attach_type fentry
    5: tracing  prog 16
            prog_type tracing  attach_type fentry
    6: tracing  prog 17
            prog_type tracing  attach_type fentry
    7: raw_tracepoint  prog 21
            tp 'sys_enter'
    8: cgroup  prog 25
            cgroup_id 584  attach_type egress
    9: cgroup  prog 25
            cgroup_id 599  attach_type egress
    10: cgroup  prog 25
            cgroup_id 614  attach_type egress
    11: cgroup  prog 25
            cgroup_id 629  attach_type egress
    Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
    Link: https://lore.kernel.org/bpf/20200429001614.1544-9-andriin@fb.com
    c5481f9a
link.c 7.17 KB