There was an error while loading. Please reload this page.
1 parent a7219fd commit 63024deCopy full SHA for 63024de
1 file changed
internal/daemon/fd_limit_unix.go
@@ -12,10 +12,14 @@ import "syscall"
12
// Unix-only because syscall.Getrlimit / syscall.Rlimit / syscall.RLIMIT_NOFILE
13
// are guarded by `//go:build unix` upstream and don't exist for GOOS=windows.
14
// See fd_limit_windows.go for the Windows stub.
15
+//
16
+// rlim.Cur is uint64 on linux and darwin but int64 on freebsd; cast to keep
17
+// the cross-GOOS return type stable. Negative values can't occur for
18
+// RLIMIT_NOFILE in practice.
19
func CurrentProcessFDLimit() uint64 {
20
var rlim syscall.Rlimit
21
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlim); err != nil {
22
return 0
23
}
- return rlim.Cur
24
+ return uint64(rlim.Cur)
25
0 commit comments