]> git.baikalelectronics.ru Git - kernel.git/commit
tools: bpftool: attempt to mount tracefs if required for tracelog cmd
authorQuentin Monnet <quentin.monnet@netronome.com>
Tue, 18 Dec 2018 10:13:18 +0000 (10:13 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 18 Dec 2018 13:47:17 +0000 (14:47 +0100)
commit6699be68a590e5aa834084a6b21cf37e689872d5
tree9eb34c8d2e69fa121c94fcba5e7419dda8eda836
parentc92bdc044c8eaf08b6013ee56b187b525f89b43a
tools: bpftool: attempt to mount tracefs if required for tracelog cmd

As a follow-up to commit d3b92d731c0d ("tools: bpftool: add a command to
dump the trace pipe"), attempt to mount the tracefs virtual file system
if it is not detected on the system before trying to dump content of the
tracing pipe on an invocation of "bpftool prog tracelog".

Usually, tracefs in automatically mounted by debugfs when the user tries
to access it (e.g. "ls /sys/kernel/debug/tracing" mounts the tracefs).
So if we failed to find it, it is probably that debugfs is not here
either. Therefore, we just attempt a single mount, at a location that
does not involve debugfs: /sys/kernel/tracing.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/common.c
tools/bpf/bpftool/main.h
tools/bpf/bpftool/tracelog.c