From a6c45f61c77c4bbec4409debb8447cd606f0db5d Mon Sep 17 00:00:00 2001 From: Sean Young Date: Fri, 12 Apr 2024 11:13:27 +0100 Subject: [PATCH] Expose io_error in SyscallError If a bpf syscall fails, it would be useful to know if this is due to not having enough permissions or that the kernel does not have BPF support. Ubuntu kernels are compiled without `CONFIG_BPF_LIRC_MODE2` so this is important for https://github.com/seanyoung/cir/ : I would like to present a useful error saying your kernel does not support BPF IR decoders, go fix your kernel. Also, when removing all BPF programs using `cir config --clear` then if there is no support for BPF, there is nothing to clear and the syscall error can be ignored. --- aya/src/sys/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aya/src/sys/mod.rs b/aya/src/sys/mod.rs index fddab712..a45f7ef8 100644 --- a/aya/src/sys/mod.rs +++ b/aya/src/sys/mod.rs @@ -48,10 +48,10 @@ pub(crate) enum Syscall<'a> { #[error("`{call}` failed")] pub struct SyscallError { /// The name of the syscall which failed. - pub(crate) call: &'static str, + pub call: &'static str, /// The [`io::Error`] returned by the syscall. #[source] - pub(crate) io_error: io::Error, + pub io_error: io::Error, } impl std::fmt::Debug for Syscall<'_> {