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
.
§type LibbpfType = bpf_link
type LibbpfType = bpf_link
libbpf
type.