Files
containerd/vendor/github.com/cilium/ebpf/internal/linux/version.go
T
dependabot[bot] d763407d4a build(deps): bump github.com/Microsoft/hcsshim
Bumps [github.com/Microsoft/hcsshim](https://github.com/Microsoft/hcsshim) from 0.15.0-rc.1 to 0.15.0-rc.3.
- [Release notes](https://github.com/Microsoft/hcsshim/releases)
- [Commits](https://github.com/Microsoft/hcsshim/compare/v0.15.0-rc.1...v0.15.0-rc.3)

---
updated-dependencies:
- dependency-name: github.com/Microsoft/hcsshim
  dependency-version: 0.15.0-rc.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-29 23:23:04 +00:00

35 lines
950 B
Go

package linux
import (
"fmt"
"sync"
"github.com/cilium/ebpf/internal"
"github.com/cilium/ebpf/internal/unix"
)
// KernelVersion returns the version of the currently running kernel.
var KernelVersion = sync.OnceValues(detectKernelVersion)
// detectKernelVersion returns the version of the running kernel.
func detectKernelVersion() (internal.Version, error) {
vc, err := vdsoVersion()
if err != nil {
return internal.Version{}, err
}
return internal.NewVersionFromCode(vc), nil
}
// 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 KernelRelease() (string, error) {
var uname unix.Utsname
if err := unix.Uname(&uname); err != nil {
return "", fmt.Errorf("uname failed: %w", err)
}
return unix.ByteSliceToString(uname.Release[:]), nil
}