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
sourceimpl 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/unregisted 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.
sourcepub fn get_fd(&self) -> i32
👎 Deprecated since 0.17.0: please use fd
instead
pub fn get_fd(&self) -> i32
please use fd
instead
Returns the file descriptor of the link.
pub fn detach(&self) -> Result<()>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Link
impl !Send for Link
impl !Sync for Link
impl Unpin for Link
impl UnwindSafe for Link
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more