From 586fd218f5469904363026680d9befa63e6a7f60 Mon Sep 17 00:00:00 2001 From: alessio Date: Mon, 21 Nov 2016 23:10:55 +0100 Subject: [PATCH] windows flimit fix --- settings/flimit.go | 16 ++++++++++++++++ settings/flimit_windows.go | 8 ++++++++ 2 files changed, 24 insertions(+) create mode 100644 settings/flimit.go create mode 100644 settings/flimit_windows.go diff --git a/settings/flimit.go b/settings/flimit.go new file mode 100644 index 0000000..a710599 --- /dev/null +++ b/settings/flimit.go @@ -0,0 +1,16 @@ +// build !windows + +package settings + +import "syscall" + +// Flimit defines the max number of watched files +func (s *Settings) Flimit() { + var rLimit syscall.Rlimit + rLimit.Max = s.Config.Flimit + rLimit.Cur = s.Config.Flimit + err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit) + if err != nil { + s.Fatal("Error Setting Rlimit", err) + } +} diff --git a/settings/flimit_windows.go b/settings/flimit_windows.go new file mode 100644 index 0000000..b0454cc --- /dev/null +++ b/settings/flimit_windows.go @@ -0,0 +1,8 @@ +package settings + +import "syscall" + +// Flimit defines the max number of watched files +func (s *Settings) Flimit() { + return +}