提交 1a1a0b03 编写于 作者: P Paul Chaignon 提交者: Andrii Nakryiko

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: 30da46b5 ("tools: bpftool: add a command to dump the trace pipe")
Signed-off-by: NQuentin Monnet <quentin@isovalent.com>
Signed-off-by: NPaul Chaignon <paul@isovalent.com>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Acked-by: NYonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211220214528.GA11706@Mem
上级 0dd668d2
...@@ -408,6 +408,8 @@ int main(int argc, char **argv) ...@@ -408,6 +408,8 @@ int main(int argc, char **argv)
bool version_requested = false; bool version_requested = false;
int opt, ret; int opt, ret;
setlinebuf(stdout);
last_do_help = do_help; last_do_help = do_help;
pretty_output = false; pretty_output = false;
json_output = false; json_output = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册