package features

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

Package features allows probing for BPF features available to the calling process.

Index

Functions

func HaveMapType

func HaveMapType(mt ebpf.MapType) error

HaveMapType probes the running kernel for the availability of the specified map type. Return values have the following semantics:

err == nil: The feature is available.
errors.Is(err, ebpf.ErrNotSupported): The feature is not available.
err != nil: Any errors encountered during probe execution, wrapped.

Note that the latter case may include false negatives, and that map creation may succeed despite an error being returned. Some map types cannot reliably be probed and will also return error. Only `nil` and `ebpf.ErrNotSupported` are conclusive.

Probe results are cached and persist throughout any process capability changes.

func HaveProgType

func HaveProgType(pt ebpf.ProgramType) error

HaveProgType probes the running kernel for the availability of the specified program type. Return values have the following semantics:

err == nil: The feature is available.
errors.Is(err, ebpf.ErrNotSupported): The feature is not available.
err != nil: Any errors encountered during probe execution, wrapped.

Note that the latter case may include false negatives, and that program creation may succeed despite an error being returned. Some program types cannot reliably be probed and will also return error. Only `nil` and `ebpf.ErrNotSupported` are conclusive.

Probe results are cached and persist throughout any process capability changes.

Source Files

doc.go map.go prog.go

Version
v0.8.0
Published
Jan 21, 2022
Platform
darwin/amd64
Imports
11 packages
Last checked
2 minutes ago

Tools for package owners.