Documentation ¶
Overview ¶
Package sysutil provides utilities for getting system-related information.
Index ¶
Constants ¶
const ( // ChronosUID is the UID of the user "chronos". // A constant is defined since this is unlikely to be changed and since // it simplifies tests. ChronosUID uint32 = 1000 // ChronosGID is the GID of the group "chronos", similar to ChronosUID. ChronosGID uint32 = 1000 )
const ( // SelfPID can be used as an argument of MountInfoForPID to return // the result for the current process. SelfPID = 0 )
Variables ¶
This section is empty.
Functions ¶
func TemperatureInputMax ¶
TemperatureInputMax returns the maximum currently observed temperature in Celsius.
Types ¶
type KernelVersion ¶
type KernelVersion struct {
// contains filtered or unexported fields
}
KernelVersion contains the Linux kernel major and minor revisions.
func KernelVersionAndArch ¶
func KernelVersionAndArch() (*KernelVersion, string, error)
KernelVersionAndArch reads the Linux kernel version and arch of the system.
func (*KernelVersion) Is ¶
func (v *KernelVersion) Is(major, minor int) bool
Is returns true if the kernel version is major.minor else false.
func (*KernelVersion) IsOrLater ¶
func (v *KernelVersion) IsOrLater(major, minor int) bool
IsOrLater returns true if the kernel version is at least major.minor else false.
func (*KernelVersion) IsOrLess ¶
func (v *KernelVersion) IsOrLess(major, minor int) bool
IsOrLess returns true if the kernel version is at most major.minor else false.
type MountInfo ¶
type MountInfo struct { MountID int ParentID int Major int Minor int Root string MountPath string MountOpts MountOpt Master int // 0 if not a slave mount PropagateFrom int // 0 if propagated_from is unavailable. Unbindable bool Fstype string MountSource string SuperOpts []string }
MountInfo is a struct containing mount point info. TODO(chavey): crbug/1126921 - replace master in structure.
func MountInfoForPID ¶
MountInfoForPID reads and parses the /proc/${PID}/mountinfo, and returns an array of mount point info for the given process. pid needs to be a valid PID or SelfPID.
func ParseMountInfo ¶
ParseMountInfo parses the content of a mountinfo file using parseLine, and returns an array of mount point info.
type MountOpt ¶
type MountOpt uint32
MountOpt is a bit flag for the mount option.
const ( // MntReadonly represents "ro". MntReadonly MountOpt = 1 << iota // MntNosuid represents "nosuid". MntNosuid // MntNodev represents "nodev". MntNodev // MntNoexec represents "noexec". MntNoexec // MntNoatime represents "noatime". MntNoatime // MntNodiratime represents "nodiratime". MntNodiratime // MntRelatime represents "relatime". MntRelatime // MntNosymfollow represents "nosymfollow". MntNosymfollow )
type Utsname ¶
type Utsname struct { // Sysname is the operating system name (e.g., "Linux"). // Corresponds to `uname -s`. Sysname string // Nodename is the name within "some implementation-defined network". // Corresponds to `uname -n`. Nodename string // Release is the operating system release (e.g., "2.6.28"). // Corresponds to `uname -r`. Release string // Version is the operating system version. // Corresponds to `uname -v`. Version string // Machine is the hardware identifier (e.g., "x86_64"). // Corresponds to `uname -m`. Machine string // Domainname is the NIS or YP domain name. This is nonstandard GNU/Linux extension. Domainname string }
Utsname contains system information.