• Prashant Bhole's avatar
    tools: bpftool: show filenames of pinned objects · 4990f1f4
    Prashant Bhole authored
    Added support to show filenames of pinned objects.
    
    For example:
    
    root@test# ./bpftool prog
    3: tracepoint  name tracepoint__irq  tag f677a7dd722299a3
        loaded_at Oct 26/11:39  uid 0
        xlated 160B  not jited  memlock 4096B  map_ids 4
        pinned /sys/fs/bpf/softirq_prog
    
    4: tracepoint  name tracepoint__irq  tag ea5dc530d00b92b6
        loaded_at Oct 26/11:39  uid 0
        xlated 392B  not jited  memlock 4096B  map_ids 4,6
    
    root@test# ./bpftool --json --pretty prog
    [{
            "id": 3,
            "type": "tracepoint",
            "name": "tracepoint__irq",
            "tag": "f677a7dd722299a3",
            "loaded_at": "Oct 26/11:39",
            "uid": 0,
            "bytes_xlated": 160,
            "jited": false,
            "bytes_memlock": 4096,
            "map_ids": [4
            ],
            "pinned": ["/sys/fs/bpf/softirq_prog"
            ]
        },{
            "id": 4,
            "type": "tracepoint",
            "name": "tracepoint__irq",
            "tag": "ea5dc530d00b92b6",
            "loaded_at": "Oct 26/11:39",
            "uid": 0,
            "bytes_xlated": 392,
            "jited": false,
            "bytes_memlock": 4096,
            "map_ids": [4,6
            ],
            "pinned": []
        }
    ]
    
    root@test# ./bpftool map
    4: hash  name start  flags 0x0
        key 4B  value 16B  max_entries 10240  memlock 1003520B
        pinned /sys/fs/bpf/softirq_map1
    5: hash  name iptr  flags 0x0
        key 4B  value 8B  max_entries 10240  memlock 921600B
    
    root@test# ./bpftool --json --pretty map
    [{
            "id": 4,
            "type": "hash",
            "name": "start",
            "flags": 0,
            "bytes_key": 4,
            "bytes_value": 16,
            "max_entries": 10240,
            "bytes_memlock": 1003520,
            "pinned": ["/sys/fs/bpf/softirq_map1"
            ]
        },{
            "id": 5,
            "type": "hash",
            "name": "iptr",
            "flags": 0,
            "bytes_key": 4,
            "bytes_value": 8,
            "max_entries": 10240,
            "bytes_memlock": 921600,
            "pinned": []
        }
    ]
    Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4990f1f4
common.c 8.3 KB