aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-08-18 15:23:12 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-18 17:36:23 -0700
commit00fa1d83a8b50351c830521d00135e823c46e7d0 (patch)
tree586aac21b3840b28a2ad2c76e13dfe7c415b2970 /tools
parentbpf: Avoid visit same object multiple times (diff)
downloadlinux-dev-00fa1d83a8b50351c830521d00135e823c46e7d0.tar.xz
linux-dev-00fa1d83a8b50351c830521d00135e823c46e7d0.zip
bpftool: Handle EAGAIN error code properly in pids collection
When the error code is EAGAIN, the kernel signals the user space should retry the read() operation for bpf iterators. Let us do it. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200818222312.2181675-1-yhs@fb.com
Diffstat (limited to 'tools')
-rw-r--r--tools/bpf/bpftool/pids.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/pids.c b/tools/bpf/bpftool/pids.c
index e3b116325403..df7d8ec76036 100644
--- a/tools/bpf/bpftool/pids.c
+++ b/tools/bpf/bpftool/pids.c
@@ -134,6 +134,8 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
while (true) {
ret = read(fd, buf, sizeof(buf));
if (ret < 0) {
+ if (errno == EAGAIN)
+ continue;
err = -errno;
p_err("failed to read PID iterator output: %d", err);
goto out;