Documentation ¶
Overview ¶
Package sysctl provides functions wrapping the sysctl interface.
Index ¶
Constants ¶
const DefaultPath = "/proc/sys/"
DefaultPath is the default path to the sysctl virtual files.
Variables ¶
This section is empty.
Functions ¶
func GetPattern ¶
GetPattern returns a map of sysctls matching a given pattern The pattern uses a POSIX extended regular expression syntax. This function matches the same sysctls that the command sysctl -a -r <pattern> would return.
func LoadConfig ¶
LoadConfig gets sysctl values from a list of sysctl configuration files. The values in the rightmost files take priority. If no file is specified, values are read from /etc/sysctl.conf.
func LoadConfigAndApply ¶
LoadConfigAndApply sets sysctl values from a list of sysctl configuration files. The values in the rightmost files take priority. If no file is specified, values are read from /etc/sysctl.conf.
Types ¶
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client is a client for reading and writing sysctls
func NewClient ¶ added in v0.2.0
NewClient returns a new Client. The path argument is the base path containing all sysctl virtual files. By default this is DefaultPath, but there may be cases where you may want to use a different path, e.g. for tests or if procfs path is mounted to a different path.
func (*Client) GetAll ¶ added in v0.2.0
GetAll returns all sysctls. This is equivalent to running the command sysctl -a.
func (*Client) GetPattern ¶ added in v0.2.0
GetPattern returns a map of sysctls matching a given pattern The pattern uses a POSIX extended regular expression syntax. This function matches the same sysctls that the command sysctl -a -r <pattern> would return.
func (*Client) LoadConfigAndApply ¶ added in v0.2.0
LoadConfigAndApply sets sysctl values from a list of sysctl configuration files. The values in the rightmost files take priority. If no file is specified, values are read from /etc/sysctl.conf.