aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/fdlimit_freebsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/utils/fdlimit_freebsd.go')
-rw-r--r--cmd/utils/fdlimit_freebsd.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/utils/fdlimit_freebsd.go b/cmd/utils/fdlimit_freebsd.go
index 4cb5013c8..f9ed8937e 100644
--- a/cmd/utils/fdlimit_freebsd.go
+++ b/cmd/utils/fdlimit_freebsd.go
@@ -52,3 +52,13 @@ func getFdLimit() (int, error) {
}
return int(limit.Cur), nil
}
+
+// getFdMaxLimit retrieves the maximum number of file descriptors this process is
+// allowed to request for itself.
+func getFdMaxLimit() (int, error) {
+ var limit syscall.Rlimit
+ if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
+ return 0, err
+ }
+ return int(limit.Max), nil
+}