lsmod

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

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

Go to latest
Published: Jan 24, 2019 License: MIT Imports: 6 Imported by: 0

README

# go-lsmod image:https://godoc.org/github.com/Djarvur/go-lsmod?status.svg["GoDoc",link="http://godoc.org/github.com/Djarvur/go-lsmod"] image:https://travis-ci.org/Djarvur/go-lsmod.svg["Build Status",link="https://travis-ci.org/Djarvur/go-lsmod"] image:https://coveralls.io/repos/Djarvur/go-lsmod/badge.svg?branch=master&service=github["Coverage Status",link="https://coveralls.io/github/Djarvur/go-lsmod?branch=master"]

simple `/proc/modules` parser

*Linux only!*

Documentation

Index

Constants

View Source
const (
	StateLive      modState = 1
	StateLoading   modState = 2
	StateUnloading modState = 3
)

Possible states of the module

View Source
const (
	TainedNone modTained = 0      // No tained flag
	TainedP    modTained = 1      // (P): A module with a non-GPL license has been loaded, this includes modules with no license. Set by modutils >= 2.4.9 and module-init-tools.
	TainedF    modTained = 2      // (F): A module was force loaded by insmod -f. Set by modutils >= 2.4.9 and module-init-tools.
	TainedS    modTained = 4      // (S): Unsafe SMP processors: SMP with CPUs not designed for SMP.
	TainedR    modTained = 8      // (R): A module was forcibly unloaded from the system by rmmod -f.
	TainedM    modTained = 16     // (M): A hardware machine check error occurred on the system.
	TainedB    modTained = 32     // (B): A bad page was discovered on the system.
	TainedU    modTained = 64     // (U): The user has asked that the system be marked "tainted". This could be because they are running software that directly modifies the hardware, or for other reasons.
	TainedD    modTained = 128    // (D): The system has died.
	TainedA    modTained = 256    // (A): The ACPI DSDT has been overridden with one supplied by the user instead of using the one provided by the hardware.
	TainedW    modTained = 512    // (W): A kernel warning has occurred.
	TainedC    modTained = 1024   // (C): A module from drivers/staging was loaded.
	TainedI    modTained = 2048   // (I): The system is working around a severe firmware bug.
	TainedO    modTained = 4096   // (O): An out-of-tree module has been loaded.
	TainedE    modTained = 8192   // (E): An unsigned module has been loaded in a kernel supporting module signature.
	TainedL    modTained = 16384  // (L): A soft lockup has previously occurred on the system.
	TainedK    modTained = 32768  // (K): The kernel has been live patched.
	TainedX    modTained = 65536  // (X): Auxiliary taint, defined and used by for distros.
	TainedT    modTained = 131072 // (T): The kernel was built with the struct randomization plugin.
)

possibble tained flags of the module

View Source
const (
	// ProcModules is a path to pseudo-file to parse
	ProcModules = "/proc/modules"
)

Variables

This section is empty.

Functions

func IsLoaded

func IsLoaded(name string) (bool, error)

IsLoaded just check if the specified module loaded

func LsMod

func LsMod() (map[string]ModInfo, error)

LsMod is a function reading and parsing /proc/modules pseudo-file

Types

type ModInfo

type ModInfo struct {
	Depends   []string
	Mem       uint64
	Instances uint64
	Offset    uint64
	Tained    modTained
	State     modState
}

ModInfo contains a module info provided by /proc/modules

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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