]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add comments to interpret bpf_prog return values
authorYonghong Song <yhs@fb.com>
Wed, 13 May 2020 18:02:18 +0000 (11:02 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 13 May 2020 19:30:50 +0000 (12:30 -0700)
commitf9de1b45b6de937bc9cdfecac9c1bcb9f5bc0848
tree7a6512153de614c5ef0f5ef361da4ba3d19d5b7b
parent640d1b88dd0b2234d8c99adccf09afa778009a5c
bpf: Add comments to interpret bpf_prog return values

Add a short comment in bpf_iter_run_prog() function to
explain how bpf_prog return value is converted to
seq_ops->show() return value:
  bpf_prog return           seq_ops()->show() return
     0                         0
     1                         -EAGAIN

When show() return value is -EAGAIN, the current
bpf_seq_read() will end. If the current seq_file buffer
is empty, -EAGAIN will return to user space. Otherwise,
the buffer will be copied to user space.
In both cases, the next bpf_seq_read() call will
try to show the same object which returned -EAGAIN
previously.

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/20200513180218.2949517-1-yhs@fb.com
kernel/bpf/bpf_iter.c