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
|
2017-04-13 14:09:53 +00:00
|
|
|
func (s *Settings) Flimit() error {
|
2016-11-21 22:10:55 +00:00
|
|
|
var rLimit syscall.Rlimit
|
2017-03-12 22:46:58 +00:00
|
|
|
rLimit.Max = uint64(s.Config.Flimit)
|
|
|
|
rLimit.Cur = uint64(s.Config.Flimit)
|
2017-04-13 14:09:53 +00:00
|
|
|
|
|
|
|
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
|
|
|
return err
|
2016-11-21 22:10:55 +00:00
|
|
|
}
|
2017-04-13 14:09:53 +00:00
|
|
|
return nil
|
2016-11-21 22:10:55 +00:00
|
|
|
}
|