|
|
|
@ -16,10 +16,6 @@ use crate::{
|
|
|
|
|
|
|
|
|
|
/// A program that can be used to get or set options on sockets.
|
|
|
|
|
///
|
|
|
|
|
/// [`SockAddr`] programs can be used to inspect or modify socket addresses passed to
|
|
|
|
|
/// various syscalls within a [cgroup]. They can be attached to a number of different
|
|
|
|
|
/// places as described in [`SockAddrAttachType`].
|
|
|
|
|
///
|
|
|
|
|
/// [`CgroupSockopt`] programs can be attached to a cgroup and will be called every
|
|
|
|
|
/// time a process executes getsockopt or getsockopt system call.
|
|
|
|
|
///
|
|
|
|
@ -30,17 +26,6 @@ use crate::{
|
|
|
|
|
/// # Examples
|
|
|
|
|
///
|
|
|
|
|
/// ```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 std::fs::File;
|
|
|
|
|
/// use std::convert::TryInto;
|
|
|
|
@ -50,7 +35,7 @@ use crate::{
|
|
|
|
|
/// let program: &mut CgroupSockopt = bpf.program_mut("cgroup_sockopt").unwrap().try_into()?;
|
|
|
|
|
/// program.load()?;
|
|
|
|
|
/// program.attach(file)?;
|
|
|
|
|
/// # Ok::<(), Error>(())
|
|
|
|
|
/// # Ok::<(), anyhow::Error>(())
|
|
|
|
|
/// ```
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
#[doc(alias = "BPF_PROG_TYPE_CGROUP_SOCKOPT")]
|
|
|
|
|