]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Print error message for bpftool cgroup show
authorHechao Li <hechaol@fb.com>
Tue, 24 Dec 2019 01:17:42 +0000 (17:17 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 26 Dec 2019 09:35:54 +0000 (10:35 +0100)
commitb82e05adda473e88e9284f58fc57c7be5baf5432
treebf84a24566a166a5c26ebc952a28ec0be6c87f4c
parent15e3f2fdc3096f5123c2d1f236d6a966f25e8646
bpf: Print error message for bpftool cgroup show

Currently, when bpftool cgroup show <path> has an error, no error
message is printed. This is confusing because the user may think the
result is empty.

Before the change:

$ bpftool cgroup show /sys/fs/cgroup
ID       AttachType      AttachFlags     Name
$ echo $?
255

After the change:
$ ./bpftool cgroup show /sys/fs/cgroup
Error: can't query bpf programs attached to /sys/fs/cgroup: Operation
not permitted

v2: Rename check_query_cgroup_progs to cgroup_has_attached_progs

Signed-off-by: Hechao Li <hechaol@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191224011742.3714301-1-hechaol@fb.com
tools/bpf/bpftool/cgroup.c