OSDN Git Service

bpftool: Set errno on skeleton failures and propagate errors
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 25 May 2021 03:59:35 +0000 (20:59 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 26 May 2021 00:32:35 +0000 (17:32 -0700)
commit9c6c0449deb41dbe3a66ab9adfd08020bba6c43d
tree5fd75a8338c75b97f64195d2bf77fccbd8819ce8
parente9fc3ce99b3485586e7e4803b63df8b4c681f897
bpftool: Set errno on skeleton failures and propagate errors

Follow libbpf's error handling conventions and pass through errors and errno
properly. Skeleton code always returned NULL on errors (not ERR_PTR(err)), so
there are no backwards compatibility concerns. But now we also set errno
properly, so it's possible to distinguish different reasons for failure, if
necessary.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210525035935.1461796-6-andrii@kernel.org
tools/bpf/bpftool/gen.c