mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-17 18:41:16 +02:00
20 lines
430 B
Go
20 lines
430 B
Go
package proc
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
// SystemProperty represents a kernel system property.
|
|
type SystemProperty struct {
|
|
Key string
|
|
Value string
|
|
}
|
|
|
|
// WriteSystemProperty writes a value to a key under /proc/sys.
|
|
func WriteSystemProperty(prop *SystemProperty) error {
|
|
keyPath := path.Join("/proc/sys", strings.Replace(prop.Key, ".", "/", -1))
|
|
return ioutil.WriteFile(keyPath, []byte(prop.Value), 0644)
|
|
}
|