features

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

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

In general, the error return values from feature probes in this package all have the following semantics unless otherwise specified:

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 resource creation may succeed despite an error being returned. For example, some map and program types cannot reliably be probed and will return an inconclusive error.

As a rule, only `nil` and `ebpf.ErrNotSupported` are conclusive.

Probe results are cached by the library and persist throughout any changes to the process' environment, like capability changes.

Index

Constants

This section is empty.

Variables

View Source
var HaveProgType = HaveProgramType

HaveProgType probes the running kernel for the availability of the specified program type.

Deprecated: use HaveProgramType() instead.

Functions

func HaveBoundedLoops

func HaveBoundedLoops() error

HaveBoundedLoops probes the running kernel if bounded loops are supported.

See the package documentation for the meaning of the error return value.

func HaveLargeInstructions

func HaveLargeInstructions() error

HaveLargeInstructions probes the running kernel if more than 4096 instructions per program are supported.

See the package documentation for the meaning of the error return value.

func HaveMapType

func HaveMapType(mt ebpf.MapType) error

HaveMapType probes the running kernel for the availability of the specified map type.

See the package documentation for the meaning of the error return value.

func HaveProgramHelper

func HaveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error

HaveProgramHelper probes the running kernel for the availability of the specified helper function to a 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. Only `nil` and `ebpf.ErrNotSupported` are conclusive.

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

func HaveProgramType

func HaveProgramType(pt ebpf.ProgramType) error

HaveProgramType probes the running kernel for the availability of the specified program type.

See the package documentation for the meaning of the error return value.

func HaveV2ISA

func HaveV2ISA() error

HaveV2ISA probes the running kernel if instructions of the v2 ISA are supported.

See the package documentation for the meaning of the error return value.

func HaveV3ISA

func HaveV3ISA() error

HaveV3ISA probes the running kernel if instructions of the v3 ISA are supported.

See the package documentation for the meaning of the error return value.

func LinuxVersionCode

func LinuxVersionCode() (uint32, error)

LinuxVersionCode returns the version of the currently running kernel as defined in the LINUX_VERSION_CODE compile-time macro. It is represented in the format described by the KERNEL_VERSION macro from linux/version.h.

Do not use the version to make assumptions about the presence of certain kernel features, always prefer feature probes in this package. Some distributions backport or disable eBPF features.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL