realize/settings/flimit.go

18 lines
351 B
Go
Raw Normal View History

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() error {
2016-11-21 22:10:55 +00:00
var rLimit syscall.Rlimit
rLimit.Max = uint64(s.Config.Flimit)
rLimit.Cur = uint64(s.Config.Flimit)
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
return err
2016-11-21 22:10:55 +00:00
}
return nil
2016-11-21 22:10:55 +00:00
}