2016-11-21 22:22:46 +00:00
|
|
|
// +build !windows
|
2016-11-21 22:10:55 +00:00
|
|
|
|
|
|
|
package settings
|
|
|
|
|
|
|
|
import "syscall"
|
|
|
|
|
|
|
|
// Flimit defines the max number of watched files
|
|
|
|
func (s *Settings) Flimit() {
|
|
|
|
var rLimit syscall.Rlimit
|
2017-03-12 22:46:58 +00:00
|
|
|
rLimit.Max = uint64(s.Config.Flimit)
|
|
|
|
rLimit.Cur = uint64(s.Config.Flimit)
|
2016-11-21 22:10:55 +00:00
|
|
|
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
|
|
if err != nil {
|
2016-12-16 22:53:27 +00:00
|
|
|
s.Fatal(err, "Error setting rlimit")
|
2016-11-21 22:10:55 +00:00
|
|
|
}
|
|
|
|
}
|