sysctl

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 12

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 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.

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