sysctl

package
v1.14.1 Latest Latest
Warning

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

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

Documentation

Overview

Package sysctl allows to change kernel parameters at runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySettings added in v1.14.0

func ApplySettings(sysSettings []Setting) error

ApplySettings applies all settings in sysSettings.

func Disable

func Disable(name string) error

Disable disables the given sysctl parameter.

func Enable

func Enable(name string) error

Enable enables the given sysctl parameter.

func GetProcfs added in v1.14.0

func GetProcfs() string

GetProcfs returns the path set in procFs. Executing SetProcFs after GetProcfs might panic depending. See SetProcfs for more info.

func Read added in v1.14.0

func Read(name string) (string, error)

Read reads the given sysctl parameter.

func ReadInt added in v1.14.0

func ReadInt(name string) (int64, error)

ReadInt reads the given sysctl parameter, return an int64 value.

func SetProcfs added in v1.14.0

func SetProcfs(path string)

SetProcfs sets path for the root's /proc. Calling it after GetProcfs causes panic.

func Write added in v1.6.3

func Write(name string, val string) error

Write writes the given sysctl parameter.

func WriteInt added in v1.14.0

func WriteInt(name string, val int64) error

WriteInt writes the given integer type sysctl parameter.

Types

type ErrInvalidSysctlParameter added in v1.14.0

type ErrInvalidSysctlParameter string

An ErrInvalidSysctlParameter is returned when a parameter is invalid.

func (ErrInvalidSysctlParameter) Error added in v1.14.0

type Setting added in v1.14.0

type Setting struct {
	Name      string
	Val       string
	IgnoreErr bool

	// Warn if non-empty is the alternative warning log message to use when IgnoreErr is false.
	Warn string
}

Setting represents a sysctl setting. Its purpose it to be able to iterate over a slice of settings.

Jump to

Keyboard shortcuts

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