pub struct Link { /* private fields */ }
Expand description
Represents an attached Program
.
This struct is used to model ownership. The underlying program will be detached when this object is dropped if nothing else is holding a reference count.
Implementations§
Source§impl Link
impl Link
Sourcepub fn update_prog(&mut self, prog: &Program<'_>) -> Result<()>
pub fn update_prog(&mut self, prog: &Program<'_>) -> Result<()>
Replace the underlying prog with prog
.
Sourcepub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Release “ownership” of underlying BPF resource (typically, a BPF program attached to some BPF hook, e.g., tracepoint, kprobe, etc). Disconnected links, when destructed through bpf_link__destroy() call won’t attempt to detach/unregistered that BPF resource. This is useful in situations where, say, attached BPF program has to outlive userspace program that attached it in the system. Depending on type of BPF program, though, there might be additional steps (like pinning BPF program in BPF FS) necessary to ensure exit of userspace program doesn’t trigger automatic detachment and clean up inside the kernel.
Trait Implementations§
Source§impl AsFd for Link
impl AsFd for Link
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl AsRawLibbpf for Link
impl AsRawLibbpf for Link
Source§fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
fn as_libbpf_object(&self) -> NonNull<Self::LibbpfType>
Retrieve the underlying libbpf_sys::bpf_link
.
Source§type LibbpfType = bpf_link
type LibbpfType = bpf_link
libbpf
type.