kernel

package
v0.0.0-...-d7a781d Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Kernel4_9 is the KernelVersion representation of kernel version 4.9
	Kernel4_9 = VersionCode(4, 9, 0) //nolint:deadcode,unused
	// Kernel4_10 is the KernelVersion representation of kernel version 4.10
	Kernel4_10 = VersionCode(4, 10, 0) //nolint:deadcode,unused
	// Kernel4_12 is the KernelVersion representation of kernel version 4.12
	Kernel4_12 = VersionCode(4, 12, 0) //nolint:deadcode,unused
	// Kernel4_13 is the KernelVersion representation of kernel version 4.13
	Kernel4_13 = VersionCode(4, 13, 0) //nolint:deadcode,unused
	// Kernel4_14 is the KernelVersion representation of kernel version 4.14
	Kernel4_14 = VersionCode(4, 14, 0) //nolint:deadcode,unused
	// Kernel4_15 is the KernelVersion representation of kernel version 4.15
	Kernel4_15 = VersionCode(4, 15, 0) //nolint:deadcode,unused
	// Kernel4_16 is the KernelVersion representation of kernel version 4.16
	Kernel4_16 = VersionCode(4, 16, 0) //nolint:deadcode,unused
	// Kernel4_18 is the KernelVersion representation of kernel version 4.18
	Kernel4_18 = VersionCode(4, 18, 0) //nolint:deadcode,unused
	// Kernel4_19 is the KernelVersion representation of kernel version 4.19
	Kernel4_19 = VersionCode(4, 19, 0) //nolint:deadcode,unused
	// Kernel4_20 is the KernelVersion representation of kernel version 4.20
	Kernel4_20 = VersionCode(4, 20, 0) //nolint:deadcode,unused
	// Kernel5_0 is the KernelVersion representation of kernel version 5.0
	Kernel5_0 = VersionCode(5, 0, 0) //nolint:deadcode,unused
	// Kernel5_1 is the KernelVersion representation of kernel version 5.1
	Kernel5_1 = VersionCode(5, 1, 0) //nolint:deadcode,unused
	// Kernel5_2 is the KernelVersion representation of kernel version 5.2
	Kernel5_2 = VersionCode(5, 2, 0) //nolint:deadcode,unused
	// Kernel5_3 is the KernelVersion representation of kernel version 5.3
	Kernel5_3 = VersionCode(5, 3, 0) //nolint:deadcode,unused
	// Kernel5_4 is the KernelVersion representation of kernel version 5.4
	Kernel5_4 = VersionCode(5, 4, 0) //nolint:deadcode,unused
	// Kernel5_5 is the KernelVersion representation of kernel version 5.5
	Kernel5_5 = VersionCode(5, 5, 0) //nolint:deadcode,unused
	// Kernel5_6 is the KernelVersion representation of kernel version 5.6
	Kernel5_6 = VersionCode(5, 6, 0) //nolint:deadcode,unused
	// Kernel5_7 is the KernelVersion representation of kernel version 5.7
	Kernel5_7 = VersionCode(5, 7, 0) //nolint:deadcode,unused
	// Kernel5_8 is the KernelVersion representation of kernel version 5.8
	Kernel5_8 = VersionCode(5, 8, 0) //nolint:deadcode,unused
	// Kernel5_9 is the KernelVersion representation of kernel version 5.9
	Kernel5_9 = VersionCode(5, 9, 0) //nolint:deadcode,unused
	// Kernel5_10 is the KernelVersion representation of kernel version 5.10
	Kernel5_10 = VersionCode(5, 10, 0) //nolint:deadcode,unused
	// Kernel5_11 is the KernelVersion representation of kernel version 5.11
	Kernel5_11 = VersionCode(5, 11, 0) //nolint:deadcode,unused
	// Kernel5_12 is the KernelVersion representation of kernel version 5.12
	Kernel5_12 = VersionCode(5, 12, 0) //nolint:deadcode,unused
	// Kernel5_13 is the KernelVersion representation of kernel version 5.13
	Kernel5_13 = VersionCode(5, 13, 0) //nolint:deadcode,unused
	// Kernel5_14 is the KernelVersion representation of kernel version 5.14
	Kernel5_14 = VersionCode(5, 14, 0) //nolint:deadcode,unused
	// Kernel5_15 is the KernelVersion representation of kernel version 5.15
	Kernel5_15 = VersionCode(5, 15, 0) //nolint:deadcode,unused
	// Kernel5_16 is the KernelVersion representation of kernel version 5.16
	Kernel5_16 = VersionCode(5, 16, 0) //nolint:deadcode,unused
)

Functions

This section is empty.

Types

type Host

type Host struct {
	OsRelease     map[string]string
	OsReleasePath string
	Code          Version
	UnameRelease  string
	// contains filtered or unexported fields
}

Host defines a the kernel and OS of a host helper

func NewHost

func NewHost() (*Host, error)

NewHost returns a new kernel version helper

func (*Host) HaveMmapableMaps

func (k *Host) HaveMmapableMaps() bool

HaveMmapableMaps returns whether the kernel supports mmapable maps.

func (*Host) HaveRingBuffers

func (k *Host) HaveRingBuffers() bool

HaveRingBuffers returns whether the kernel supports ring buffer.

func (*Host) IsAmazonLinuxKernel

func (k *Host) IsAmazonLinuxKernel() bool

IsAmazonLinuxKernel returns whether the kernel is an amazon kernel

func (*Host) IsCOSKernel

func (k *Host) IsCOSKernel() bool

IsCOSKernel returns whether the kernel is a suse kernel

func (*Host) IsDebianKernel

func (k *Host) IsDebianKernel() bool

IsDebianKernel returns whether the kernel is a debian kernel

func (*Host) IsInRangeCloseOpen

func (k *Host) IsInRangeCloseOpen(begin Version, end Version) bool

IsInRangeCloseOpen returns whether the kernel version is between the begin version (included) and the end version (excluded)

func (*Host) IsOracleUEKKernel

func (k *Host) IsOracleUEKKernel() bool

IsOracleUEKKernel returns whether the kernel is an oracle uek kernel

func (*Host) IsRH7Kernel

func (k *Host) IsRH7Kernel() bool

IsRH7Kernel returns whether the kernel is a rh7 kernel

func (*Host) IsRH8Kernel

func (k *Host) IsRH8Kernel() bool

IsRH8Kernel returns whether the kernel is a rh8 kernel

func (*Host) IsSLESKernel

func (k *Host) IsSLESKernel() bool

IsSLESKernel returns whether the kernel is a sles kernel

func (*Host) IsSuse12Kernel

func (k *Host) IsSuse12Kernel() bool

IsSuse12Kernel returns whether the kernel is a sles 12 kernel

func (*Host) IsSuse15Kernel

func (k *Host) IsSuse15Kernel() bool

IsSuse15Kernel returns whether the kernel is a sles 15 kernel

func (*Host) IsSuseKernel

func (k *Host) IsSuseKernel() bool

IsSuseKernel returns whether the kernel is a suse kernel

func (*Host) IsUbuntuKernel

func (k *Host) IsUbuntuKernel() bool

IsUbuntuKernel returns whether the kernel is an ubuntu kernel

func (*Host) String

func (k *Host) String() string

func (*Host) UbuntuKernelVersion

func (k *Host) UbuntuKernelVersion() *UbuntuKernelVersion

UbuntuKernelVersion returns a parsed ubuntu kernel version or nil if not on ubuntu or if parsing failed

type UbuntuKernelVersion

type UbuntuKernelVersion struct {
	Major  int
	Minor  int
	Patch  int // always 0
	Abi    int
	Flavor string
}

UbuntuKernelVersion represents a version from an ubuntu kernel Please see: https://ubuntu.com/kernel for the documentation of this scheme

func NewUbuntuKernelVersion

func NewUbuntuKernelVersion(unameRelease string) (*UbuntuKernelVersion, error)

NewUbuntuKernelVersion parses the ubuntu release string and returns a structure with each extracted fields

type Version

type Version uint32

Version is a numerical representation of a kernel version

func HostVersion

func HostVersion() (Version, error)

HostVersion returns the running kernel version of the host

func ParseReleaseString

func ParseReleaseString(releaseString string) (Version, error)

ParseReleaseString converts a release string with format 4.4.2[-1] to a kernel version number in LINUX_VERSION_CODE format. That is, for kernel "a.b.c", the version number will be (a<<16 + b<<8 + c)

func ParseVersion

func ParseVersion(s string) Version

ParseVersion parses a string in the format of x.x.x to a Version

func VersionCode

func VersionCode(major, minor, patch byte) Version

VersionCode returns a Version computed from the individual parts of a x.x.x version

func (Version) Major

func (v Version) Major() uint8

Major returns the major number of the version code

func (Version) Minor

func (v Version) Minor() uint8

Minor returns the minor number of the version code

func (Version) Patch

func (v Version) Patch() uint8

Patch returns the patch number of the version code

func (Version) String

func (v Version) String() string

String returns a string representing the version in x.x.x format

Jump to

Keyboard shortcuts

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