linuxUtils

package module
v0.0.0-...-a33b350 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUsernsProcess

func CreateUsernsProcess(idMap *specs.LinuxIDMapping, execFunc func(), cwd string, newMountNs bool) (int, func(), error)

CreateUsernsProcess forks the current process into a new Linux user-namespace, using the given the ID mapping (common to both uid and gid). Returns the pid of the new process and a "kill" function (so that the caller can kill the child when desired). The new process executes the given function.

NOTE: adapted from github.com/containers/storage/drivers/overlay

func GetDistro

func GetDistro() (string, error)

Obtain system's linux distribution.

func GetDistroPath

func GetDistroPath(rootfs string) (string, error)

Obtain system's linux distribution in the passed rootfs.

func GetKernelRelease

func GetKernelRelease() (string, error)

GetKernelRelease returns the kernel release (e.g., "4.18")

func GetLinuxHeaderPath

func GetLinuxHeaderPath(distro string) (string, error)

Obtain location of kernel-headers for a given linux distro.

func KernelCurrentVersionCmp

func KernelCurrentVersionCmp(k1Major, k1Minor int) (int, error)

Compares the given kernel version versus the current kernel version. Returns 0 if versions are equal, 1 if the current kernel has higher version than the given one, -1 otherwise.

func KernelModSupported

func KernelModSupported(mod string) (bool, error)

KernelModSupported returns nil if the given module is loaded in the kernel.

func ParseKernelRelease

func ParseKernelRelease(rel string) (int, int, error)

Parses the kernel release string (obtained from GetKernelRelease()) and returns the major and minor numbers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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