• Stanislav Fomichev's avatar
    bpftool: add pop and dequeue commands · 74f312ef
    Stanislav Fomichev authored
    This is intended to be used with queues and stacks, it pops and prints
    the last element via bpf_map_lookup_and_delete_elem.
    
    Example:
    
    bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
    bpftool map push pinned /sys/fs/bpf/q value 0 1 2 3
    bpftool map pop pinned /sys/fs/bpf/q
    value: 00 01 02 03
    bpftool map pop pinned /sys/fs/bpf/q
    Error: empty map
    
    bpftool map create /sys/fs/bpf/s type stack value 4 entries 10 name s
    bpftool map enqueue pinned /sys/fs/bpf/s value 0 1 2 3
    bpftool map dequeue pinned /sys/fs/bpf/s
    value: 00 01 02 03
    bpftool map dequeue pinned /sys/fs/bpf/s
    Error: empty map
    Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    74f312ef
bpftool-map.rst 8.64 KB