Re: [PATCH bpf-next 6/6] bpftool: add pop and dequeue commands

2019-01-16 Thread Stanislav Fomichev
On 01/15, Jakub Kicinski wrote: > On Tue, 15 Jan 2019 15:22:52 -0800, Stanislav Fomichev wrote: > > +static int do_pop_dequeue(int argc, char **argv) > > +{ > > + struct bpf_map_info info = {}; > > + __u32 len = sizeof(info); > > + void *key, *value; > > + int err; > > + int fd; > > + > >

Re: [PATCH bpf-next 6/6] bpftool: add pop and dequeue commands

2019-01-15 Thread Jakub Kicinski
On Tue, 15 Jan 2019 15:22:52 -0800, Stanislav Fomichev wrote: > +static int do_pop_dequeue(int argc, char **argv) > +{ > + struct bpf_map_info info = {}; > + __u32 len = sizeof(info); > + void *key, *value; > + int err; > + int fd; > + > + if (argc < 2) > + usage

[PATCH bpf-next 6/6] bpftool: add pop and dequeue commands

2019-01-15 Thread Stanislav Fomichev
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