summaryrefslogtreecommitdiff
path: root/tools/bpf
diff options
context:
space:
mode:
authorPaul Chaignon <paul@isovalent.com>2021-12-20 22:45:28 +0100
committerAndrii Nakryiko <andrii@kernel.org>2021-12-21 15:44:51 -0800
commit1a1a0b0364ad291bd8e509da104ac8b5b1afec5d (patch)
tree2a33bb0a3dcba47642b729a064c56134c2035053 /tools/bpf
parent0dd668d2080c46cf914e131f341fa114a34c5a20 (diff)
bpftool: Enable line buffering for stdout
The output of bpftool prog tracelog is currently buffered, which is inconvenient when piping the output into other commands. A simple tracelog | grep will typically not display anything. This patch fixes it by enabling line buffering on stdout for the whole bpftool binary. Fixes: 30da46b5dc3a ("tools: bpftool: add a command to dump the trace pipe") Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Paul Chaignon <paul@isovalent.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20211220214528.GA11706@Mem
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 8b71500e7cb2..020e91a542d5 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -408,6 +408,8 @@ int main(int argc, char **argv)
bool version_requested = false;
int opt, ret;
+ setlinebuf(stdout);
+
last_do_help = do_help;
pretty_output = false;
json_output = false;