package linux

import "github.com/cilium/ebpf/internal/linux"

Package linux contains OS specific wrappers around package unix.

Index

Variables

var KernelVersion = sync.OnceValues(detectKernelVersion)

KernelVersion returns the version of the currently running kernel.

Functions

func FSType

func FSType(path string) (int64, error)

func FindKConfig

func FindKConfig() (*os.File, error)

FindKConfig searches for a kconfig file on the host.

It first reads from /boot/config- of the current running kernel and tries /proc/config.gz if nothing was found in /boot. If none of the file provide a kconfig, it returns an error.

func KernelRelease

func KernelRelease() (string, error)

KernelRelease returns the release string of the running kernel. Its format depends on the Linux distribution and corresponds to directory names in /lib/modules by convention. Some examples are 5.15.17-1-lts and 4.19.0-16-amd64.

func ParseCPUsFromFile

func ParseCPUsFromFile(path string) (int, error)

func PlatformPrefix

func PlatformPrefix() string

PlatformPrefix returns the platform-dependent syscall wrapper prefix used by the linux kernel.

Based on https://github.com/golang/go/blob/master/src/go/build/syslist.go and https://github.com/libbpf/libbpf/blob/master/src/libbpf.c#L10047

Source Files

auxv.go cpu.go doc.go kconfig.go platform.go statfs.go vdso.go version.go

Version
v0.18.0 (latest)
Published
Apr 2, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
1 week ago

Tools for package owners.