diff --git a/aya/src/programs/extension.rs b/aya/src/programs/extension.rs index c5895ab69..cc3b8387b 100644 --- a/aya/src/programs/extension.rs +++ b/aya/src/programs/extension.rs @@ -37,22 +37,12 @@ pub enum ExtensionError { /// use aya::{BpfLoader, programs::{Xdp, XdpFlags, Extension}}; /// /// let mut bpf = BpfLoader::new().extension("extension").load_file("app.o")?; -/// let mut prog = None; -/// let mut ext = None; -/// for (name, program) in bpf.programs_mut() { -/// match name { -/// "main" => prog = Some(program), -/// "extension" => ext = Some(program), -/// _ => {}, -/// } -/// } -/// -/// let prog: &mut Xdp = prog.unwrap().try_into()?; +/// let prog: &mut Xdp = bpf.program_mut("main").unwrap().try_into()?; /// prog.load()?; /// prog.attach("eth0", XdpFlags::default())?; /// /// let prog_fd = prog.fd().unwrap(); -/// let ext: &mut Extension = ext.unwrap().try_into()?; +/// let ext: &mut Extension = bpf.program_mut("extension").unwrap().try_into()?; /// ext.load(prog_fd, "function_to_replace")?; /// ext.attach()?; /// Ok::<(), aya::BpfError>(()) diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index ea25acbc8..2ad4aedba 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -211,13 +211,12 @@ pub enum ProgramError { } /// A [`Program`] file descriptor. -#[derive(Copy, Clone)] -pub struct ProgramFd<'program>(BorrowedFd<'program>); +pub struct ProgramFd(OwnedFd); -impl AsFd for ProgramFd<'_> { +impl AsFd for ProgramFd { fn as_fd(&self) -> BorrowedFd<'_> { let Self(fd) = self; - *fd + fd.as_fd() } } @@ -370,7 +369,7 @@ impl Program { /// /// Can be used to add a program to a [`crate::maps::ProgramArray`] or attach an [`Extension`] program. /// Can be converted to [`RawFd`] using [`AsRawFd`]. - pub fn fd(&self) -> Option { + pub fn fd(&self) -> Result { match self { Program::KProbe(p) => p.fd(), Program::UProbe(p) => p.fd(), @@ -721,8 +720,12 @@ macro_rules! impl_fd { $( impl $struct_name { /// Returns the file descriptor of this Program. - pub fn fd(&self) -> Option { - self.data.fd.as_ref().map(|fd| ProgramFd(fd.as_fd())) + pub fn fd(&self) -> Result { + self.data.fd + .as_ref() + .ok_or(ProgramError::NotLoaded) + .and_then(|fd| fd.try_clone().map_err(Into::into)) + .map(ProgramFd) } } )+ diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index 15c5e4a15..a9a9c803f 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -91,7 +91,7 @@ impl> aya::maps::ProgramArray pub fn aya::maps::ProgramArray::indices(&self) -> aya::maps::MapKeys<'_, u32> impl> aya::maps::ProgramArray pub fn aya::maps::ProgramArray::clear_index(&mut self, index: &u32) -> core::result::Result<(), aya::maps::MapError> -pub fn aya::maps::ProgramArray::set(&mut self, index: u32, program: aya::programs::ProgramFd<'_>, flags: u64) -> core::result::Result<(), aya::maps::MapError> +pub fn aya::maps::ProgramArray::set(&mut self, index: u32, program: aya::programs::ProgramFd, flags: u64) -> core::result::Result<(), aya::maps::MapError> impl core::convert::TryFrom for aya::maps::ProgramArray pub type aya::maps::ProgramArray::Error = aya::maps::MapError pub fn aya::maps::ProgramArray::try_from(map: aya::maps::Map) -> core::result::Result, aya::maps::MapError> @@ -1502,7 +1502,7 @@ impl> aya::maps::ProgramArray pub fn aya::maps::ProgramArray::indices(&self) -> aya::maps::MapKeys<'_, u32> impl> aya::maps::ProgramArray pub fn aya::maps::ProgramArray::clear_index(&mut self, index: &u32) -> core::result::Result<(), aya::maps::MapError> -pub fn aya::maps::ProgramArray::set(&mut self, index: u32, program: aya::programs::ProgramFd<'_>, flags: u64) -> core::result::Result<(), aya::maps::MapError> +pub fn aya::maps::ProgramArray::set(&mut self, index: u32, program: aya::programs::ProgramFd, flags: u64) -> core::result::Result<(), aya::maps::MapError> impl core::convert::TryFrom for aya::maps::ProgramArray pub type aya::maps::ProgramArray::Error = aya::maps::MapError pub fn aya::maps::ProgramArray::try_from(map: aya::maps::Map) -> core::result::Result, aya::maps::MapError> @@ -1804,7 +1804,7 @@ pub fn aya::programs::cgroup_device::CgroupDevice::detach(&mut self, link_id: ay pub fn aya::programs::cgroup_device::CgroupDevice::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_device::CgroupDevice::take_link(&mut self, link_id: aya::programs::cgroup_device::CgroupDeviceLinkId) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice -pub fn aya::programs::cgroup_device::CgroupDevice::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_device::CgroupDevice::fd(&self) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice pub fn aya::programs::cgroup_device::CgroupDevice::from_pin>(path: P) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice @@ -1947,7 +1947,7 @@ pub fn aya::programs::cgroup_skb::CgroupSkb::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_skb::CgroupSkb::take_link(&mut self, link_id: aya::programs::cgroup_skb::CgroupSkbLinkId) -> core::result::Result impl aya::programs::cgroup_skb::CgroupSkb -pub fn aya::programs::cgroup_skb::CgroupSkb::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_skb::CgroupSkb::fd(&self) -> core::result::Result impl aya::programs::cgroup_skb::CgroupSkb pub fn aya::programs::cgroup_skb::CgroupSkb::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_skb::CgroupSkb::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -2055,7 +2055,7 @@ pub fn aya::programs::cgroup_sock::CgroupSock::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sock::CgroupSock::take_link(&mut self, link_id: aya::programs::cgroup_sock::CgroupSockLinkId) -> core::result::Result impl aya::programs::cgroup_sock::CgroupSock -pub fn aya::programs::cgroup_sock::CgroupSock::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sock::CgroupSock::fd(&self) -> core::result::Result impl aya::programs::cgroup_sock::CgroupSock pub fn aya::programs::cgroup_sock::CgroupSock::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sock::CgroupSock::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -2163,7 +2163,7 @@ pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::take_link(&mut self, link_id: aya::programs::cgroup_sock_addr::CgroupSockAddrLinkId) -> core::result::Result impl aya::programs::cgroup_sock_addr::CgroupSockAddr -pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::fd(&self) -> core::result::Result impl aya::programs::cgroup_sock_addr::CgroupSockAddr pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -2271,7 +2271,7 @@ pub fn aya::programs::cgroup_sockopt::CgroupSockopt::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sockopt::CgroupSockopt::take_link(&mut self, link_id: aya::programs::cgroup_sockopt::CgroupSockoptLinkId) -> core::result::Result impl aya::programs::cgroup_sockopt::CgroupSockopt -pub fn aya::programs::cgroup_sockopt::CgroupSockopt::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sockopt::CgroupSockopt::fd(&self) -> core::result::Result impl aya::programs::cgroup_sockopt::CgroupSockopt pub fn aya::programs::cgroup_sockopt::CgroupSockopt::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sockopt::CgroupSockopt::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -2377,7 +2377,7 @@ pub fn aya::programs::cgroup_sysctl::CgroupSysctl::detach(&mut self, link_id: ay pub fn aya::programs::cgroup_sysctl::CgroupSysctl::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sysctl::CgroupSysctl::take_link(&mut self, link_id: aya::programs::cgroup_sysctl::CgroupSysctlLinkId) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl -pub fn aya::programs::cgroup_sysctl::CgroupSysctl::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sysctl::CgroupSysctl::fd(&self) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl pub fn aya::programs::cgroup_sysctl::CgroupSysctl::from_pin>(path: P) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl @@ -2515,12 +2515,12 @@ pub fn aya::programs::extension::ExtensionError::from(t: T) -> T pub struct aya::programs::extension::Extension impl aya::programs::extension::Extension pub fn aya::programs::extension::Extension::attach(&mut self) -> core::result::Result -pub fn aya::programs::extension::Extension::attach_to_program(&mut self, program: aya::programs::ProgramFd<'_>, func_name: &str) -> core::result::Result +pub fn aya::programs::extension::Extension::attach_to_program(&mut self, program: aya::programs::ProgramFd, func_name: &str) -> core::result::Result pub fn aya::programs::extension::Extension::detach(&mut self, link_id: aya::programs::extension::ExtensionLinkId) -> core::result::Result<(), aya::programs::ProgramError> -pub fn aya::programs::extension::Extension::load(&mut self, program: aya::programs::ProgramFd<'_>, func_name: &str) -> core::result::Result<(), aya::programs::ProgramError> +pub fn aya::programs::extension::Extension::load(&mut self, program: aya::programs::ProgramFd, func_name: &str) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::extension::Extension::take_link(&mut self, link_id: aya::programs::extension::ExtensionLinkId) -> core::result::Result impl aya::programs::extension::Extension -pub fn aya::programs::extension::Extension::fd(&self) -> core::option::Option> +pub fn aya::programs::extension::Extension::fd(&self) -> core::result::Result impl aya::programs::extension::Extension pub fn aya::programs::extension::Extension::from_pin>(path: P) -> core::result::Result impl aya::programs::extension::Extension @@ -2632,7 +2632,7 @@ pub fn aya::programs::fentry::FEntry::detach(&mut self, link_id: aya::programs:: pub fn aya::programs::fentry::FEntry::load(&mut self, fn_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::fentry::FEntry::take_link(&mut self, link_id: aya::programs::fentry::FEntryLinkId) -> core::result::Result impl aya::programs::fentry::FEntry -pub fn aya::programs::fentry::FEntry::fd(&self) -> core::option::Option> +pub fn aya::programs::fentry::FEntry::fd(&self) -> core::result::Result impl aya::programs::fentry::FEntry pub fn aya::programs::fentry::FEntry::from_pin>(path: P) -> core::result::Result impl aya::programs::fentry::FEntry @@ -2744,7 +2744,7 @@ pub fn aya::programs::fexit::FExit::detach(&mut self, link_id: aya::programs::fe pub fn aya::programs::fexit::FExit::load(&mut self, fn_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::fexit::FExit::take_link(&mut self, link_id: aya::programs::fexit::FExitLinkId) -> core::result::Result impl aya::programs::fexit::FExit -pub fn aya::programs::fexit::FExit::fd(&self) -> core::option::Option> +pub fn aya::programs::fexit::FExit::fd(&self) -> core::result::Result impl aya::programs::fexit::FExit pub fn aya::programs::fexit::FExit::from_pin>(path: P) -> core::result::Result impl aya::programs::fexit::FExit @@ -2895,7 +2895,7 @@ pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::kprobe::KProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::kprobe::KProbe::take_link(&mut self, link_id: aya::programs::kprobe::KProbeLinkId) -> core::result::Result impl aya::programs::kprobe::KProbe -pub fn aya::programs::kprobe::KProbe::fd(&self) -> core::option::Option> +pub fn aya::programs::kprobe::KProbe::fd(&self) -> core::result::Result impl aya::programs::kprobe::KProbe pub fn aya::programs::kprobe::KProbe::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::kprobe::KProbe::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -3393,7 +3393,7 @@ pub fn aya::programs::lirc_mode2::LircMode2::load(&mut self) -> core::result::Re pub fn aya::programs::lirc_mode2::LircMode2::query(target_fd: T) -> core::result::Result, aya::programs::ProgramError> pub fn aya::programs::lirc_mode2::LircMode2::take_link(&mut self, link_id: aya::programs::lirc_mode2::LircLinkId) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 -pub fn aya::programs::lirc_mode2::LircMode2::fd(&self) -> core::option::Option> +pub fn aya::programs::lirc_mode2::LircMode2::fd(&self) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 pub fn aya::programs::lirc_mode2::LircMode2::from_pin>(path: P) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 @@ -3440,7 +3440,7 @@ pub fn aya::programs::lsm::Lsm::detach(&mut self, link_id: aya::programs::lsm::L pub fn aya::programs::lsm::Lsm::load(&mut self, lsm_hook_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::lsm::Lsm::take_link(&mut self, link_id: aya::programs::lsm::LsmLinkId) -> core::result::Result impl aya::programs::lsm::Lsm -pub fn aya::programs::lsm::Lsm::fd(&self) -> core::option::Option> +pub fn aya::programs::lsm::Lsm::fd(&self) -> core::result::Result impl aya::programs::lsm::Lsm pub fn aya::programs::lsm::Lsm::from_pin>(path: P) -> core::result::Result impl aya::programs::lsm::Lsm @@ -3725,7 +3725,7 @@ pub fn aya::programs::perf_event::PerfEvent::detach(&mut self, link_id: aya::pro pub fn aya::programs::perf_event::PerfEvent::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::perf_event::PerfEvent::take_link(&mut self, link_id: aya::programs::perf_event::PerfEventLinkId) -> core::result::Result impl aya::programs::perf_event::PerfEvent -pub fn aya::programs::perf_event::PerfEvent::fd(&self) -> core::option::Option> +pub fn aya::programs::perf_event::PerfEvent::fd(&self) -> core::result::Result impl aya::programs::perf_event::PerfEvent pub fn aya::programs::perf_event::PerfEvent::from_pin>(path: P) -> core::result::Result impl aya::programs::perf_event::PerfEvent @@ -3919,7 +3919,7 @@ pub fn aya::programs::tc::SchedClassifier::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::tc::SchedClassifier::take_link(&mut self, link_id: aya::programs::tc::SchedClassifierLinkId) -> core::result::Result impl aya::programs::tc::SchedClassifier -pub fn aya::programs::tc::SchedClassifier::fd(&self) -> core::option::Option> +pub fn aya::programs::tc::SchedClassifier::fd(&self) -> core::result::Result impl aya::programs::tc::SchedClassifier pub fn aya::programs::tc::SchedClassifier::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::tc::SchedClassifier::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -4057,7 +4057,7 @@ pub fn aya::programs::tp_btf::BtfTracePoint::detach(&mut self, link_id: aya::pro pub fn aya::programs::tp_btf::BtfTracePoint::load(&mut self, tracepoint: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::tp_btf::BtfTracePoint::take_link(&mut self, link_id: aya::programs::tp_btf::BtfTracePointLinkId) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint -pub fn aya::programs::tp_btf::BtfTracePoint::fd(&self) -> core::option::Option> +pub fn aya::programs::tp_btf::BtfTracePoint::fd(&self) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint pub fn aya::programs::tp_btf::BtfTracePoint::from_pin>(path: P) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint @@ -4206,7 +4206,7 @@ pub fn aya::programs::trace_point::TracePoint::detach(&mut self, link_id: aya::p pub fn aya::programs::trace_point::TracePoint::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::trace_point::TracePoint::take_link(&mut self, link_id: aya::programs::trace_point::TracePointLinkId) -> core::result::Result impl aya::programs::trace_point::TracePoint -pub fn aya::programs::trace_point::TracePoint::fd(&self) -> core::option::Option> +pub fn aya::programs::trace_point::TracePoint::fd(&self) -> core::result::Result impl aya::programs::trace_point::TracePoint pub fn aya::programs::trace_point::TracePoint::from_pin>(path: P) -> core::result::Result impl aya::programs::trace_point::TracePoint @@ -4366,7 +4366,7 @@ pub fn aya::programs::uprobe::UProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::uprobe::UProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::uprobe::UProbe::take_link(&mut self, link_id: aya::programs::uprobe::UProbeLinkId) -> core::result::Result impl aya::programs::uprobe::UProbe -pub fn aya::programs::uprobe::UProbe::fd(&self) -> core::option::Option> +pub fn aya::programs::uprobe::UProbe::fd(&self) -> core::result::Result impl aya::programs::uprobe::UProbe pub fn aya::programs::uprobe::UProbe::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::uprobe::UProbe::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -4516,7 +4516,7 @@ pub fn aya::programs::xdp::Xdp::detach(&mut self, link_id: aya::programs::xdp::X pub fn aya::programs::xdp::Xdp::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::xdp::Xdp::take_link(&mut self, link_id: aya::programs::xdp::XdpLinkId) -> core::result::Result impl aya::programs::xdp::Xdp -pub fn aya::programs::xdp::Xdp::fd(&self) -> core::option::Option> +pub fn aya::programs::xdp::Xdp::fd(&self) -> core::result::Result impl aya::programs::xdp::Xdp pub fn aya::programs::xdp::Xdp::from_pin>(path: P) -> core::result::Result impl aya::programs::xdp::Xdp @@ -4973,7 +4973,7 @@ pub aya::programs::Program::TracePoint(aya::programs::trace_point::TracePoint) pub aya::programs::Program::UProbe(aya::programs::uprobe::UProbe) pub aya::programs::Program::Xdp(aya::programs::xdp::Xdp) impl aya::programs::Program -pub fn aya::programs::Program::fd(&self) -> core::option::Option> +pub fn aya::programs::Program::fd(&self) -> core::result::Result pub fn aya::programs::Program::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::Program::prog_type(&self) -> aya_obj::generated::linux_bindings_x86_64::bpf_prog_type pub fn aya::programs::Program::unload(self) -> core::result::Result<(), aya::programs::ProgramError> @@ -5524,7 +5524,7 @@ pub fn aya::programs::tp_btf::BtfTracePoint::detach(&mut self, link_id: aya::pro pub fn aya::programs::tp_btf::BtfTracePoint::load(&mut self, tracepoint: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::tp_btf::BtfTracePoint::take_link(&mut self, link_id: aya::programs::tp_btf::BtfTracePointLinkId) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint -pub fn aya::programs::tp_btf::BtfTracePoint::fd(&self) -> core::option::Option> +pub fn aya::programs::tp_btf::BtfTracePoint::fd(&self) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint pub fn aya::programs::tp_btf::BtfTracePoint::from_pin>(path: P) -> core::result::Result impl aya::programs::tp_btf::BtfTracePoint @@ -5570,7 +5570,7 @@ pub fn aya::programs::cgroup_device::CgroupDevice::detach(&mut self, link_id: ay pub fn aya::programs::cgroup_device::CgroupDevice::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_device::CgroupDevice::take_link(&mut self, link_id: aya::programs::cgroup_device::CgroupDeviceLinkId) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice -pub fn aya::programs::cgroup_device::CgroupDevice::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_device::CgroupDevice::fd(&self) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice pub fn aya::programs::cgroup_device::CgroupDevice::from_pin>(path: P) -> core::result::Result impl aya::programs::cgroup_device::CgroupDevice @@ -5618,7 +5618,7 @@ pub fn aya::programs::cgroup_skb::CgroupSkb::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_skb::CgroupSkb::take_link(&mut self, link_id: aya::programs::cgroup_skb::CgroupSkbLinkId) -> core::result::Result impl aya::programs::cgroup_skb::CgroupSkb -pub fn aya::programs::cgroup_skb::CgroupSkb::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_skb::CgroupSkb::fd(&self) -> core::result::Result impl aya::programs::cgroup_skb::CgroupSkb pub fn aya::programs::cgroup_skb::CgroupSkb::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_skb::CgroupSkb::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -5663,7 +5663,7 @@ pub fn aya::programs::cgroup_sock::CgroupSock::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sock::CgroupSock::take_link(&mut self, link_id: aya::programs::cgroup_sock::CgroupSockLinkId) -> core::result::Result impl aya::programs::cgroup_sock::CgroupSock -pub fn aya::programs::cgroup_sock::CgroupSock::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sock::CgroupSock::fd(&self) -> core::result::Result impl aya::programs::cgroup_sock::CgroupSock pub fn aya::programs::cgroup_sock::CgroupSock::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sock::CgroupSock::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -5708,7 +5708,7 @@ pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::take_link(&mut self, link_id: aya::programs::cgroup_sock_addr::CgroupSockAddrLinkId) -> core::result::Result impl aya::programs::cgroup_sock_addr::CgroupSockAddr -pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::fd(&self) -> core::result::Result impl aya::programs::cgroup_sock_addr::CgroupSockAddr pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sock_addr::CgroupSockAddr::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -5753,7 +5753,7 @@ pub fn aya::programs::cgroup_sockopt::CgroupSockopt::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sockopt::CgroupSockopt::take_link(&mut self, link_id: aya::programs::cgroup_sockopt::CgroupSockoptLinkId) -> core::result::Result impl aya::programs::cgroup_sockopt::CgroupSockopt -pub fn aya::programs::cgroup_sockopt::CgroupSockopt::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sockopt::CgroupSockopt::fd(&self) -> core::result::Result impl aya::programs::cgroup_sockopt::CgroupSockopt pub fn aya::programs::cgroup_sockopt::CgroupSockopt::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::cgroup_sockopt::CgroupSockopt::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -5797,7 +5797,7 @@ pub fn aya::programs::cgroup_sysctl::CgroupSysctl::detach(&mut self, link_id: ay pub fn aya::programs::cgroup_sysctl::CgroupSysctl::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::cgroup_sysctl::CgroupSysctl::take_link(&mut self, link_id: aya::programs::cgroup_sysctl::CgroupSysctlLinkId) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl -pub fn aya::programs::cgroup_sysctl::CgroupSysctl::fd(&self) -> core::option::Option> +pub fn aya::programs::cgroup_sysctl::CgroupSysctl::fd(&self) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl pub fn aya::programs::cgroup_sysctl::CgroupSysctl::from_pin>(path: P) -> core::result::Result impl aya::programs::cgroup_sysctl::CgroupSysctl @@ -5839,12 +5839,12 @@ pub fn aya::programs::cgroup_sysctl::CgroupSysctl::from(t: T) -> T pub struct aya::programs::Extension impl aya::programs::extension::Extension pub fn aya::programs::extension::Extension::attach(&mut self) -> core::result::Result -pub fn aya::programs::extension::Extension::attach_to_program(&mut self, program: aya::programs::ProgramFd<'_>, func_name: &str) -> core::result::Result +pub fn aya::programs::extension::Extension::attach_to_program(&mut self, program: aya::programs::ProgramFd, func_name: &str) -> core::result::Result pub fn aya::programs::extension::Extension::detach(&mut self, link_id: aya::programs::extension::ExtensionLinkId) -> core::result::Result<(), aya::programs::ProgramError> -pub fn aya::programs::extension::Extension::load(&mut self, program: aya::programs::ProgramFd<'_>, func_name: &str) -> core::result::Result<(), aya::programs::ProgramError> +pub fn aya::programs::extension::Extension::load(&mut self, program: aya::programs::ProgramFd, func_name: &str) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::extension::Extension::take_link(&mut self, link_id: aya::programs::extension::ExtensionLinkId) -> core::result::Result impl aya::programs::extension::Extension -pub fn aya::programs::extension::Extension::fd(&self) -> core::option::Option> +pub fn aya::programs::extension::Extension::fd(&self) -> core::result::Result impl aya::programs::extension::Extension pub fn aya::programs::extension::Extension::from_pin>(path: P) -> core::result::Result impl aya::programs::extension::Extension @@ -5890,7 +5890,7 @@ pub fn aya::programs::fentry::FEntry::detach(&mut self, link_id: aya::programs:: pub fn aya::programs::fentry::FEntry::load(&mut self, fn_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::fentry::FEntry::take_link(&mut self, link_id: aya::programs::fentry::FEntryLinkId) -> core::result::Result impl aya::programs::fentry::FEntry -pub fn aya::programs::fentry::FEntry::fd(&self) -> core::option::Option> +pub fn aya::programs::fentry::FEntry::fd(&self) -> core::result::Result impl aya::programs::fentry::FEntry pub fn aya::programs::fentry::FEntry::from_pin>(path: P) -> core::result::Result impl aya::programs::fentry::FEntry @@ -5936,7 +5936,7 @@ pub fn aya::programs::fexit::FExit::detach(&mut self, link_id: aya::programs::fe pub fn aya::programs::fexit::FExit::load(&mut self, fn_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::fexit::FExit::take_link(&mut self, link_id: aya::programs::fexit::FExitLinkId) -> core::result::Result impl aya::programs::fexit::FExit -pub fn aya::programs::fexit::FExit::fd(&self) -> core::option::Option> +pub fn aya::programs::fexit::FExit::fd(&self) -> core::result::Result impl aya::programs::fexit::FExit pub fn aya::programs::fexit::FExit::from_pin>(path: P) -> core::result::Result impl aya::programs::fexit::FExit @@ -5984,7 +5984,7 @@ pub fn aya::programs::kprobe::KProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::kprobe::KProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::kprobe::KProbe::take_link(&mut self, link_id: aya::programs::kprobe::KProbeLinkId) -> core::result::Result impl aya::programs::kprobe::KProbe -pub fn aya::programs::kprobe::KProbe::fd(&self) -> core::option::Option> +pub fn aya::programs::kprobe::KProbe::fd(&self) -> core::result::Result impl aya::programs::kprobe::KProbe pub fn aya::programs::kprobe::KProbe::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::kprobe::KProbe::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -6029,7 +6029,7 @@ pub fn aya::programs::lirc_mode2::LircMode2::load(&mut self) -> core::result::Re pub fn aya::programs::lirc_mode2::LircMode2::query(target_fd: T) -> core::result::Result, aya::programs::ProgramError> pub fn aya::programs::lirc_mode2::LircMode2::take_link(&mut self, link_id: aya::programs::lirc_mode2::LircLinkId) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 -pub fn aya::programs::lirc_mode2::LircMode2::fd(&self) -> core::option::Option> +pub fn aya::programs::lirc_mode2::LircMode2::fd(&self) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 pub fn aya::programs::lirc_mode2::LircMode2::from_pin>(path: P) -> core::result::Result impl aya::programs::lirc_mode2::LircMode2 @@ -6075,7 +6075,7 @@ pub fn aya::programs::lsm::Lsm::detach(&mut self, link_id: aya::programs::lsm::L pub fn aya::programs::lsm::Lsm::load(&mut self, lsm_hook_name: &str, btf: &aya_obj::btf::btf::Btf) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::lsm::Lsm::take_link(&mut self, link_id: aya::programs::lsm::LsmLinkId) -> core::result::Result impl aya::programs::lsm::Lsm -pub fn aya::programs::lsm::Lsm::fd(&self) -> core::option::Option> +pub fn aya::programs::lsm::Lsm::fd(&self) -> core::result::Result impl aya::programs::lsm::Lsm pub fn aya::programs::lsm::Lsm::from_pin>(path: P) -> core::result::Result impl aya::programs::lsm::Lsm @@ -6121,7 +6121,7 @@ pub fn aya::programs::perf_event::PerfEvent::detach(&mut self, link_id: aya::pro pub fn aya::programs::perf_event::PerfEvent::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::perf_event::PerfEvent::take_link(&mut self, link_id: aya::programs::perf_event::PerfEventLinkId) -> core::result::Result impl aya::programs::perf_event::PerfEvent -pub fn aya::programs::perf_event::PerfEvent::fd(&self) -> core::option::Option> +pub fn aya::programs::perf_event::PerfEvent::fd(&self) -> core::result::Result impl aya::programs::perf_event::PerfEvent pub fn aya::programs::perf_event::PerfEvent::from_pin>(path: P) -> core::result::Result impl aya::programs::perf_event::PerfEvent @@ -6160,37 +6160,30 @@ impl core::borrow::BorrowMut for aya::programs::perf_event::PerfEvent wher pub fn aya::programs::perf_event::PerfEvent::borrow_mut(&mut self) -> &mut T impl core::convert::From for aya::programs::perf_event::PerfEvent pub fn aya::programs::perf_event::PerfEvent::from(t: T) -> T -pub struct aya::programs::ProgramFd<'program>(_) -impl std::os::fd::owned::AsFd for aya::programs::ProgramFd<'_> -pub fn aya::programs::ProgramFd<'_>::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_> -impl<'program> core::clone::Clone for aya::programs::ProgramFd<'program> -pub fn aya::programs::ProgramFd<'program>::clone(&self) -> aya::programs::ProgramFd<'program> -impl<'program> core::marker::Copy for aya::programs::ProgramFd<'program> -impl<'program> core::marker::Send for aya::programs::ProgramFd<'program> -impl<'program> core::marker::Sync for aya::programs::ProgramFd<'program> -impl<'program> core::marker::Unpin for aya::programs::ProgramFd<'program> -impl<'program> core::panic::unwind_safe::RefUnwindSafe for aya::programs::ProgramFd<'program> -impl<'program> core::panic::unwind_safe::UnwindSafe for aya::programs::ProgramFd<'program> -impl core::convert::Into for aya::programs::ProgramFd<'program> where U: core::convert::From -pub fn aya::programs::ProgramFd<'program>::into(self) -> U -impl core::convert::TryFrom for aya::programs::ProgramFd<'program> where U: core::convert::Into -pub type aya::programs::ProgramFd<'program>::Error = core::convert::Infallible -pub fn aya::programs::ProgramFd<'program>::try_from(value: U) -> core::result::Result>::Error> -impl core::convert::TryInto for aya::programs::ProgramFd<'program> where U: core::convert::TryFrom -pub type aya::programs::ProgramFd<'program>::Error = >::Error -pub fn aya::programs::ProgramFd<'program>::try_into(self) -> core::result::Result>::Error> -impl alloc::borrow::ToOwned for aya::programs::ProgramFd<'program> where T: core::clone::Clone -pub type aya::programs::ProgramFd<'program>::Owned = T -pub fn aya::programs::ProgramFd<'program>::clone_into(&self, target: &mut T) -pub fn aya::programs::ProgramFd<'program>::to_owned(&self) -> T -impl core::any::Any for aya::programs::ProgramFd<'program> where T: 'static + core::marker::Sized -pub fn aya::programs::ProgramFd<'program>::type_id(&self) -> core::any::TypeId -impl core::borrow::Borrow for aya::programs::ProgramFd<'program> where T: core::marker::Sized -pub fn aya::programs::ProgramFd<'program>::borrow(&self) -> &T -impl core::borrow::BorrowMut for aya::programs::ProgramFd<'program> where T: core::marker::Sized -pub fn aya::programs::ProgramFd<'program>::borrow_mut(&mut self) -> &mut T -impl core::convert::From for aya::programs::ProgramFd<'program> -pub fn aya::programs::ProgramFd<'program>::from(t: T) -> T +pub struct aya::programs::ProgramFd(_) +impl std::os::fd::owned::AsFd for aya::programs::ProgramFd +pub fn aya::programs::ProgramFd::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_> +impl core::marker::Send for aya::programs::ProgramFd +impl core::marker::Sync for aya::programs::ProgramFd +impl core::marker::Unpin for aya::programs::ProgramFd +impl core::panic::unwind_safe::RefUnwindSafe for aya::programs::ProgramFd +impl core::panic::unwind_safe::UnwindSafe for aya::programs::ProgramFd +impl core::convert::Into for aya::programs::ProgramFd where U: core::convert::From +pub fn aya::programs::ProgramFd::into(self) -> U +impl core::convert::TryFrom for aya::programs::ProgramFd where U: core::convert::Into +pub type aya::programs::ProgramFd::Error = core::convert::Infallible +pub fn aya::programs::ProgramFd::try_from(value: U) -> core::result::Result>::Error> +impl core::convert::TryInto for aya::programs::ProgramFd where U: core::convert::TryFrom +pub type aya::programs::ProgramFd::Error = >::Error +pub fn aya::programs::ProgramFd::try_into(self) -> core::result::Result>::Error> +impl core::any::Any for aya::programs::ProgramFd where T: 'static + core::marker::Sized +pub fn aya::programs::ProgramFd::type_id(&self) -> core::any::TypeId +impl core::borrow::Borrow for aya::programs::ProgramFd where T: core::marker::Sized +pub fn aya::programs::ProgramFd::borrow(&self) -> &T +impl core::borrow::BorrowMut for aya::programs::ProgramFd where T: core::marker::Sized +pub fn aya::programs::ProgramFd::borrow_mut(&mut self) -> &mut T +impl core::convert::From for aya::programs::ProgramFd +pub fn aya::programs::ProgramFd::from(t: T) -> T pub struct aya::programs::ProgramInfo(_) impl aya::programs::ProgramInfo pub fn aya::programs::ProgramInfo::fd(&self) -> core::result::Result @@ -6228,7 +6221,7 @@ pub fn aya::programs::RawTracePoint::detach(&mut self, link_id: RawTracePointLin pub fn aya::programs::RawTracePoint::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::RawTracePoint::take_link(&mut self, link_id: RawTracePointLinkId) -> core::result::Result impl aya::programs::RawTracePoint -pub fn aya::programs::RawTracePoint::fd(&self) -> core::option::Option> +pub fn aya::programs::RawTracePoint::fd(&self) -> core::result::Result impl aya::programs::RawTracePoint pub fn aya::programs::RawTracePoint::from_pin>(path: P) -> core::result::Result impl aya::programs::RawTracePoint @@ -6276,7 +6269,7 @@ pub fn aya::programs::tc::SchedClassifier::from_pin core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::tc::SchedClassifier::take_link(&mut self, link_id: aya::programs::tc::SchedClassifierLinkId) -> core::result::Result impl aya::programs::tc::SchedClassifier -pub fn aya::programs::tc::SchedClassifier::fd(&self) -> core::option::Option> +pub fn aya::programs::tc::SchedClassifier::fd(&self) -> core::result::Result impl aya::programs::tc::SchedClassifier pub fn aya::programs::tc::SchedClassifier::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::tc::SchedClassifier::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -6320,7 +6313,7 @@ pub fn aya::programs::SkLookup::detach(&mut self, link_id: SkLookupLinkId) -> co pub fn aya::programs::SkLookup::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::SkLookup::take_link(&mut self, link_id: SkLookupLinkId) -> core::result::Result impl aya::programs::SkLookup -pub fn aya::programs::SkLookup::fd(&self) -> core::option::Option> +pub fn aya::programs::SkLookup::fd(&self) -> core::result::Result impl aya::programs::SkLookup pub fn aya::programs::SkLookup::from_pin>(path: P) -> core::result::Result impl aya::programs::SkLookup @@ -6366,7 +6359,7 @@ pub fn aya::programs::SkMsg::detach(&mut self, link_id: SkMsgLinkId) -> core::re pub fn aya::programs::SkMsg::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::SkMsg::take_link(&mut self, link_id: SkMsgLinkId) -> core::result::Result impl aya::programs::SkMsg -pub fn aya::programs::SkMsg::fd(&self) -> core::option::Option> +pub fn aya::programs::SkMsg::fd(&self) -> core::result::Result impl aya::programs::SkMsg pub fn aya::programs::SkMsg::from_pin>(path: P) -> core::result::Result impl aya::programs::SkMsg @@ -6413,7 +6406,7 @@ pub fn aya::programs::SkSkb::from_pin>( pub fn aya::programs::SkSkb::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::SkSkb::take_link(&mut self, link_id: SkSkbLinkId) -> core::result::Result impl aya::programs::SkSkb -pub fn aya::programs::SkSkb::fd(&self) -> core::option::Option> +pub fn aya::programs::SkSkb::fd(&self) -> core::result::Result impl aya::programs::SkSkb pub fn aya::programs::SkSkb::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::SkSkb::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -6457,7 +6450,7 @@ pub fn aya::programs::SockOps::detach(&mut self, link_id: SockOpsLinkId) -> core pub fn aya::programs::SockOps::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::SockOps::take_link(&mut self, link_id: SockOpsLinkId) -> core::result::Result impl aya::programs::SockOps -pub fn aya::programs::SockOps::fd(&self) -> core::option::Option> +pub fn aya::programs::SockOps::fd(&self) -> core::result::Result impl aya::programs::SockOps pub fn aya::programs::SockOps::from_pin>(path: P) -> core::result::Result impl aya::programs::SockOps @@ -6503,7 +6496,7 @@ pub fn aya::programs::SocketFilter::detach(&mut self, link_id: SocketFilterLinkI pub fn aya::programs::SocketFilter::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::SocketFilter::take_link(&mut self, link_id: SocketFilterLinkId) -> core::result::Result impl aya::programs::SocketFilter -pub fn aya::programs::SocketFilter::fd(&self) -> core::option::Option> +pub fn aya::programs::SocketFilter::fd(&self) -> core::result::Result impl aya::programs::SocketFilter pub fn aya::programs::SocketFilter::from_pin>(path: P) -> core::result::Result impl aya::programs::SocketFilter @@ -6549,7 +6542,7 @@ pub fn aya::programs::trace_point::TracePoint::detach(&mut self, link_id: aya::p pub fn aya::programs::trace_point::TracePoint::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::trace_point::TracePoint::take_link(&mut self, link_id: aya::programs::trace_point::TracePointLinkId) -> core::result::Result impl aya::programs::trace_point::TracePoint -pub fn aya::programs::trace_point::TracePoint::fd(&self) -> core::option::Option> +pub fn aya::programs::trace_point::TracePoint::fd(&self) -> core::result::Result impl aya::programs::trace_point::TracePoint pub fn aya::programs::trace_point::TracePoint::from_pin>(path: P) -> core::result::Result impl aya::programs::trace_point::TracePoint @@ -6597,7 +6590,7 @@ pub fn aya::programs::uprobe::UProbe::kind(&self) -> aya::programs::ProbeKind pub fn aya::programs::uprobe::UProbe::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::uprobe::UProbe::take_link(&mut self, link_id: aya::programs::uprobe::UProbeLinkId) -> core::result::Result impl aya::programs::uprobe::UProbe -pub fn aya::programs::uprobe::UProbe::fd(&self) -> core::option::Option> +pub fn aya::programs::uprobe::UProbe::fd(&self) -> core::result::Result impl aya::programs::uprobe::UProbe pub fn aya::programs::uprobe::UProbe::pin>(&mut self, path: P) -> core::result::Result<(), aya::pin::PinError> pub fn aya::programs::uprobe::UProbe::unpin(self) -> core::result::Result<(), std::io::error::Error> @@ -6643,7 +6636,7 @@ pub fn aya::programs::xdp::Xdp::detach(&mut self, link_id: aya::programs::xdp::X pub fn aya::programs::xdp::Xdp::load(&mut self) -> core::result::Result<(), aya::programs::ProgramError> pub fn aya::programs::xdp::Xdp::take_link(&mut self, link_id: aya::programs::xdp::XdpLinkId) -> core::result::Result impl aya::programs::xdp::Xdp -pub fn aya::programs::xdp::Xdp::fd(&self) -> core::option::Option> +pub fn aya::programs::xdp::Xdp::fd(&self) -> core::result::Result impl aya::programs::xdp::Xdp pub fn aya::programs::xdp::Xdp::from_pin>(path: P) -> core::result::Result impl aya::programs::xdp::Xdp