package pin

import "github.com/cilium/ebpf/pin"

Index

Functions

func WalkDir

func WalkDir(root string, opts *ebpf.LoadPinOptions) iter.Seq2[*Pin, error]

WalkDir walks the file tree rooted at path and yields a Pin for each BPF object below the path.

Callers must invoke Pin.Take if they wish to hold on to the object.

Types

type Pin

type Pin struct {
	Path   string
	Object io.Closer
}

Pin represents an object and its pinned path.

func (*Pin) Take

func (p *Pin) Take()

Take ownership of Pin.Object.

The caller is responsible for calling close on [Pin.Object].

type Pinner

type Pinner interface {
	io.Closer
	Pin(string) error
}

Pinner is an interface implemented by all eBPF objects that support pinning to a bpf virtual filesystem.

func Load

func Load(path string, opts *ebpf.LoadPinOptions) (Pinner, error)

Load retrieves a pinned object from a bpf virtual filesystem. It returns one of ebpf.Map, ebpf.Program, or link.Link.

Trying to open anything other than a bpf object is an error.

Source Files

doc.go load.go pin.go walk_other.go

Version
v0.19.0 (latest)
Published
Jun 24, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
1 day ago

Tools for package owners.