sysctl

package
v1.14.0-snapshot.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 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

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

func GetProcfs() string

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

func Read

func Read(name string) (string, error)

Read reads the given sysctl parameter.

func ReadInt

func ReadInt(name string) (int64, error)

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

func SetProcfs

func SetProcfs(path string)

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

func Write

func Write(name string, val string) error

Write writes the given sysctl parameter.

func WriteInt

func WriteInt(name string, val int64) error

WriteInt writes the given integer type sysctl parameter.

Types

type ErrInvalidSysctlParameter

type ErrInvalidSysctlParameter string

An ErrInvalidSysctlParameter is returned when a parameter is invalid.

func (ErrInvalidSysctlParameter) Error

type Setting

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