Documentation
¶
Overview ¶
Package sysctl provides methods for reading kernel parameters
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns kernel parameter value as a string
Example ¶
paramValue, err := Get("kernel.random.boot_id") if err != nil { panic(err.Error()) } fmt.Printf("Boot ID: %s\n", paramValue)
Output:
Types ¶
type Params ¶ added in v13.5.0
Params contains all kernel parameters
func All ¶ added in v13.5.0
All returns all kernel parameters
Example ¶
params, err := All() if err != nil { panic(err.Error()) } for n, v := range params { fmt.Printf("%s → %s\n", n, v) }
Output:
func (Params) Get ¶ added in v13.5.0
Get returns kernel parameter value as a string
Example ¶
params, err := All() if err != nil { panic(err.Error()) } fmt.Printf("Boot ID: %s\n", params.Get("kernel.random.boot_id"))
Output:
func (Params) GetI ¶ added in v13.5.0
GetI returns kernel parameter value as an int
Example ¶
params, err := All() if err != nil { panic(err.Error()) } paramValue, err := params.GetI("kernel.pty.max") if err != nil { panic(err.Error()) } fmt.Printf("PTY Max: %d\n", paramValue)
Output:
Click to show internal directories.
Click to hide internal directories.