aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/fdlimit_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/utils/fdlimit_unix.go')
-rw-r--r--cmd/utils/fdlimit_unix.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/utils/fdlimit_unix.go b/cmd/utils/fdlimit_unix.go
index 08e153bbd..c08d1fab0 100644
--- a/cmd/utils/fdlimit_unix.go
+++ b/cmd/utils/fdlimit_unix.go
@@ -48,3 +48,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
+}