]> git.baikalelectronics.ru Git - kernel.git/commit
samples: bpf: Refactor test_cgrp2_attach -- use getopt, and add mode
authorSargun Dhillon <sargun@sargun.me>
Mon, 28 Nov 2016 22:52:42 +0000 (14:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Nov 2016 15:29:48 +0000 (10:29 -0500)
commit4063554606f19f50dd7f12b115ca1e5479f7db4b
treefa1466cac716fbc067492fd270164b04923e9f82
parent1ba2aee45cb00a2efa7b4cfcc07c26007b8d696f
samples: bpf: Refactor test_cgrp2_attach -- use getopt, and add mode

This patch modifies test_cgrp2_attach to use getopt so we can use standard
command line parsing.

It also adds an option to run the program in detach only mode. This does
not attach a new filter at the cgroup, but only runs the detach command.

Lastly, it changes the attach code to not detach and then attach. It relies
on the 'hotswap' behaviour of CGroup BPF programs to be able to change
in-place. If detach-then-attach behaviour needs to be tested, the example
can be run in detach only mode prior to attachment.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/test_cgrp2_attach.c