Skip to content

Commit 00fa1d8

Browse files
yonghong-songAlexei Starovoitov
authored andcommitted
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 <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent e60572b commit 00fa1d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/bpf/bpftool/pids.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ int build_obj_refs_table(struct obj_refs_table *table, enum bpf_obj_type type)
134134
while (true) {
135135
ret = read(fd, buf, sizeof(buf));
136136
if (ret < 0) {
137+
if (errno == EAGAIN)
138+
continue;
137139
err = -errno;
138140
p_err("failed to read PID iterator output: %d", err);
139141
goto out;

0 commit comments

Comments
 (0)