bpftool: Enable line buffering for stdout

[ Upstream commit 1a1a0b0364 ]

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: 30da46b5dc ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Paul Chaignon 2021-12-20 22:45:28 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 79d6a406df
Коммит 77c5e99644
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -402,6 +402,8 @@ int main(int argc, char **argv)
};
int opt, ret;
setlinebuf(stdout);
last_do_help = do_help;
pretty_output = false;
json_output = false;