Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
improve tuner load error messaging
Signed-off-by: Alan Maguire <[email protected]>
  • Loading branch information
alan-maguire committed Oct 9, 2024
commit 5477624e2d2bea57984e5b53f1992bd53f2f8309
7 changes: 4 additions & 3 deletions src/bpftune.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,10 @@ int main(int argc, char *argv[])

bpftune_cap_drop();

if (init(BPFTUNER_LIB_DIR)) {
bpftune_log(LOG_ERR, "could not initialize tuners in '%s'\n",
BPFTUNER_LIB_DIR);
err = init(BPFTUNER_LIB_DIR);
if (err) {
bpftune_log(LOG_ERR, "could not initialize tuners in '%s': %s\n",
BPFTUNER_LIB_DIR, strerror(-err));
exit(EXIT_FAILURE);
}
/* optional dir absence will not trigger failure */
Expand Down
12 changes: 10 additions & 2 deletions src/libbpftune.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,16 @@ int __bpftuner_bpf_load(struct bpftuner *tuner, const char **optionals)
}
err = bpf_object__load_skeleton(tuner->skeleton);
if (err) {
bpftune_log_bpf_err(err, "could not load skeleton: %s\n");
goto out;
switch (err) {
case -ESRCH:
bpftune_log(LOG_ERR, "tuner '%s' failed to load, tracing target was not found; this can occur for unstable tracing targets like kernel functions.\n",
tuner->name);
goto out;
default:
bpftune_log(LOG_ERR, "BPF load for tuner '%s; failed: '%s': %s\n",
tuner->name, strerror(-err));
goto out;
}
}

bpftuner_map_init(tuner, "ring_buffer_map", &tuner->ring_buffer_map,
Expand Down