libbpf: Add errno string to loader debug messages

The return of bpf_prog_load() library call is insufficient, we also need
errno to know what the bpf(2) syscall did.

Bug: 143236645

Change-Id: Id2c543fdb63b1e077278a8b1ede03a21afad74dc
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
This commit is contained in:
Joel Fernandes (Google) 2019-11-08 16:28:14 -05:00 • committed by Joel Fernandes
commit 88eef6ad55

View file

@ -524,8 +524,8 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
fd = bpf_prog_load(cs[i].type, cs[i].name.c_str(), (struct bpf_insn*)cs[i].data.data(),
cs[i].data.size(), license.c_str(), kvers, 0,
log_buf.data(), log_buf.size());
ALOGD("New bpf core prog_load for %s (%s) returned: %d\n", elfPath, cs[i].name.c_str(),
fd);
ALOGD("bpf_prog_load lib call for %s (%s) returned: %d (%s)\n", elfPath,
cs[i].name.c_str(), fd, std::strerror(errno));
if (fd <= 0)
ALOGE("bpf_prog_load: log_buf contents: %s\n", (char *)log_buf.data());