|
|
@ -23,12 +23,25 @@ use crate::{
|
|
|
|
/// # Examples
|
|
|
|
/// # Examples
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// ```no_run
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// # #[derive(Debug, thiserror::Error)]
|
|
|
|
|
|
|
|
/// # enum Error {
|
|
|
|
|
|
|
|
/// # #[error(transparent)]
|
|
|
|
|
|
|
|
/// # IO(#[from] std::io::Error),
|
|
|
|
|
|
|
|
/// # #[error(transparent)]
|
|
|
|
|
|
|
|
/// # Map(#[from] aya::maps::MapError),
|
|
|
|
|
|
|
|
/// # #[error(transparent)]
|
|
|
|
|
|
|
|
/// # Program(#[from] aya::programs::ProgramError),
|
|
|
|
|
|
|
|
/// # #[error(transparent)]
|
|
|
|
|
|
|
|
/// # Bpf(#[from] aya::BpfError)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// # let mut bpf = aya::Bpf::load(&[])?;
|
|
|
|
/// use aya::programs::CgroupDevice;
|
|
|
|
/// use aya::programs::CgroupDevice;
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// let cgroup = std::fs::File::open("/sys/fs/cgroup/unified")?;
|
|
|
|
/// let cgroup = std::fs::File::open("/sys/fs/cgroup/unified")?;
|
|
|
|
/// let program: &mut CgroupDevice = bpf.program_mut("cgroup_dev").unwrap().try_into()?;
|
|
|
|
/// let program: &mut CgroupDevice = bpf.program_mut("cgroup_dev").unwrap().try_into()?;
|
|
|
|
/// program.load()?;
|
|
|
|
/// program.load()?;
|
|
|
|
/// program.attach(cgroup)?;
|
|
|
|
/// program.attach(cgroup)?;
|
|
|
|
|
|
|
|
/// # Ok::<(), Error>(())
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[doc(alias = "BPF_PROG_TYPE_CGROUP_DEVICE")]
|
|
|
|
#[doc(alias = "BPF_PROG_TYPE_CGROUP_DEVICE")]
|
|
|
|