package kernel

import "github.com/docker/cli/components/engine/pkg/parsers/kernel"

Package kernel provides helper function to get, parse and compare kernel versions for different platforms.

Index

Functions

func CompareKernelVersion

func CompareKernelVersion(a, b VersionInfo) int

CompareKernelVersion compares two kernel.VersionInfo structs. Returns -1 if a < b, 0 if a == b, 1 it a > b

Types

type Utsname

type Utsname struct {
	Release [65]byte
}

Utsname represents the system name structure. It is defined here to make it portable as it is available on linux but not on windows.

type VersionInfo

type VersionInfo struct {
	Kernel int    // Version of the kernel (e.g. 4.1.2-generic -> 4)
	Major  int    // Major part of the kernel version (e.g. 4.1.2-generic -> 1)
	Minor  int    // Minor part of the kernel version (e.g. 4.1.2-generic -> 2)
	Flavor string // Flavor of the kernel version (e.g. 4.1.2-generic -> generic)
}

VersionInfo holds information about the kernel.

func ParseRelease

func ParseRelease(release string) (*VersionInfo, error)

ParseRelease parses a string and creates a VersionInfo based on it.

func (*VersionInfo) String

func (k *VersionInfo) String() string

Source Files

kernel.go uname_unsupported.go

Version
v17.11.0-ce+incompatible
Published
Nov 20, 2017
Platform
js/wasm
Imports
2 packages
Last checked
3 hours ago

Tools for package owners.