mirror of https://github.com/k3s-io/k3s
build util function for write sys file
Change-Id: I8f122b4314c1d983e7ba1ce1d66ce876bef0dca9pull/6/head
parent
6306ab00d2
commit
ad89825065
|
@ -55,7 +55,7 @@ func (realConntracker) SetMax(max int) error {
|
|||
}
|
||||
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
||||
glog.Infof("Setting conntrack hashsize to %d", max/4)
|
||||
return ioutil.WriteFile("/sys/module/nf_conntrack/parameters/hashsize", []byte(strconv.Itoa(max/4)), 0640)
|
||||
return writeIntStringFile("/sys/module/nf_conntrack/parameters/hashsize", max/4)
|
||||
}
|
||||
|
||||
func (realConntracker) SetTCPEstablishedTimeout(seconds int) error {
|
||||
|
@ -86,3 +86,7 @@ func isSysFSWritable() (bool, error) {
|
|||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func writeIntStringFile(filename string, value int) error {
|
||||
return ioutil.WriteFile(filename, []byte(strconv.Itoa(value)), 0640)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue