瀏覽代碼

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.
Sean Young 1 年之前
父節點
當前提交
a6c45f61c7
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      aya/src/sys/mod.rs

+ 2 - 2
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<'_> {