From 88eef6ad5554b24525be0fee5ce651c703f09f09 Mon Sep 17 00:00:00 2001 From: "Joel Fernandes (Google)" Date: Fri, 8 Nov 2019 16:28:14 -0500 Subject: [PATCH] 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) --- libbpf_android/Loader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libbpf_android/Loader.cpp b/libbpf_android/Loader.cpp index d02ed87..16b4a2a 100644 --- a/libbpf_android/Loader.cpp +++ b/libbpf_android/Loader.cpp @@ -524,8 +524,8 @@ static int loadCodeSections(const char* elfPath, vector& 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());