Help us shape the future of Go! Take the 2026 Go Developer Survey

sysctl

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package sysctl allows to change kernel parameters at runtime.

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"sysctl",
	"Manages sysctl settings",

	cell.Config(defaultConfig),

	cell.Provide(
		newReconcilingSysctl,
	),
	cell.ProvidePrivate(
		tables.NewSysctlTable,

		newReconciler,
		newOps,
	),
	cell.ProvidePrivate(
		func() afero.Fs {
			return afero.NewOsFs()
		},
	),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ProcFs string `mapstructure:"procfs"`
}

func (Config) Flags

func (cfg Config) Flags(flags *pflag.FlagSet)

type Sysctl

type Sysctl interface {
	// Disable disables the given sysctl parameter.
	// It blocks until the parameter has been actually set to "0",
	// or timeouts after reconciliationTimeout.
	Disable(name []string) error

	// Enable enables the given sysctl parameter.
	// It blocks until the parameter has been actually set to "1",
	// or timeouts after reconciliationTimeout.
	Enable(name []string) error

	// Write writes the given sysctl parameter.
	// It blocks until the parameter has been actually set to val,
	// or timeouts after reconciliationTimeout.
	Write(name []string, val string) error

	// WriteInt writes the given integer type sysctl parameter.
	// It blocks until the parameter has been actually set to val,
	// or timeouts after reconciliationTimeout.
	WriteInt(name []string, val int64) error

	// ApplySettings applies all settings in sysSettings.
	// After applying all settings, it blocks until the parameters have been
	// reconciled, or timeouts after reconciliationTimeout.
	ApplySettings(sysSettings []tables.Sysctl) error

	// Read reads the given sysctl parameter.
	Read(name []string) (string, error)

	// ReadInt reads the given sysctl parameter, return an int64 value.
	ReadInt(name []string) (int64, error)
}

func NewDirectSysctl

func NewDirectSysctl(fs afero.Fs, procFs string) Sysctl

NewDirectSysctl creates a Sysctl implementation that directly interacts with the given `fs`. It doesn't reconcile and should only be used when using the reconciling variant is not available.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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