linux

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnameNull is a placeholder.
	UnameNull unameFlags = iota
	// UnameOS is "sysname" or "uname -s".
	UnameOS
	// UnameArch is "machine" or "uname -m".
	UnameArch
	// UnameRelease is "release" or "uname -r".
	UnameRelease
	// UnameDomain is "domainname", the kernel domain name.
	UnameDomain
	// UnameHostname is "Nodename" or "uname -n"
	UnameHostname
	// UnameVersion is "version", or "uname -v".
	UnameVersion
)

Variables

This section is empty.

Functions

func GetUname

func GetUname(unameFlags string) (un string, err error)

GetUname uses system calls to retrieve the same values as the uname linux command

func Uptime added in v0.7.7

func Uptime() (utime time.Duration, err error)

Uptime returns the time since the system was booted. Be sure to check err before using the returned value.

Types

type RAMInfo added in v0.7.7

type RAMInfo struct {
	Total int64
	// Free is the amount of memory that is not being used.
	// This does not take into account memory that is being used for caching.
	// For more information, see the comments at the top of this file.
	Free      int64
	Used      int64
	Shared    int64
	Buffers   int64
	Cached    int64
	SwapTotal int64
	SwapFree  int64
	// contains filtered or unexported fields
}

RAMInfo is a struct that contains information about the running system's memory. Please see important notes in the struct definition.

type SystemInfo added in v0.7.7

type SystemInfo struct {
	// Uptime is the time since the system was booted.
	Uptime time.Duration
	// Loads is a 3 element array containing the 1, 5, and 15 minute load averages.
	Loads [3]uint64
	// RAM is a struct containing information about the system's RAM. See notes on this.
	RAM RAMInfo
	// Procs is the number of current processes.
	Procs uint16
}

func Sysinfo added in v0.7.7

func Sysinfo() (systemInfo *SystemInfo, err error)

Sysinfo returns a SystemInfo struct containing information about the running system. For memory, please see important notes in the RAMInfo struct definition and the top of this file. Be sure to check err before using the returned value.

Jump to

Keyboard shortcuts

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