realize/settings/flimit.go

18 lines
343 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
2017-09-03 18:01:30 +00:00
rLimit.Max = uint64(s.FileLimit)
rLimit.Cur = uint64(s.FileLimit)
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
}