mirror of https://github.com/status-im/consul.git
18 lines
462 B
Go
18 lines
462 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
//go:build !windows
|
|
|
|
package config
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// getrlimit return the max file descriptors allocated by system
|
|
// return the number of file descriptors max
|
|
func getrlimit() (uint64, error) {
|
|
var limit unix.Rlimit
|
|
err := unix.Getrlimit(unix.RLIMIT_NOFILE, &limit)
|
|
// nolint:unconvert // Rlimit.Cur may not be uint64 on all platforms
|
|
return uint64(limit.Cur), err
|
|
}
|