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

Create link from BPF FS file.

Takes ownership from pointer.

Safety

It is not safe to manipulate ptr after this operation.

Replace the underlying prog with prog.

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.

Pin this link to bpffs.

Unpin from bpffs

👎 Deprecated since 0.17.0:

please use fd instead

Returns the file descriptor of the link.

Returns the file descriptor of the link.

Returns path to BPF FS file or None if not pinned.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.