diff --git a/app.go b/app.go index 0ba9a765..dacf1034 100644 --- a/app.go +++ b/app.go @@ -311,18 +311,6 @@ func enableTLS13() { } } -// Set user-specified limit of how many fd's we can use -// https://github.com/AdguardTeam/AdGuardHome/issues/659 -func setRlimit(val uint) { - var rlim syscall.Rlimit - rlim.Max = uint64(val) - rlim.Cur = uint64(val) - err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim) - if err != nil { - log.Error("Setrlimit() failed: %v", err) - } -} - func cleanup() { log.Info("Stopping AdGuard Home") diff --git a/os_unix.go b/os_unix.go new file mode 100644 index 00000000..12a918c8 --- /dev/null +++ b/os_unix.go @@ -0,0 +1,21 @@ +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris + +package main + +import ( + "syscall" + + "github.com/AdguardTeam/golibs/log" +) + +// Set user-specified limit of how many fd's we can use +// https://github.com/AdguardTeam/AdGuardHome/issues/659 +func setRlimit(val uint) { + var rlim syscall.Rlimit + rlim.Max = uint64(val) + rlim.Cur = uint64(val) + err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim) + if err != nil { + log.Error("Setrlimit() failed: %v", err) + } +} diff --git a/os_windows.go b/os_windows.go new file mode 100644 index 00000000..1155e04b --- /dev/null +++ b/os_windows.go @@ -0,0 +1,5 @@ +package main + +// Set user-specified limit of how many fd's we can use +func setRlimit(val uint) { +}