mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-10-24 00:23:21 +08:00

* bump go.mod to Go 1.19 and run go fix * stop using the deprecated io/ioutil package * bump go.mod to Go 1.19 and run go fix * bump go.mod to Go 1.19 and run go fix * bump go.mod to Go 1.19 and run go fix * stop using the deprecated io/ioutil package * bump go.mod to Go 1.19 and run go fix * stop using the deprecated io/ioutil package * update .github/workflows/go-test.yml * update .github/workflows/go-check.yml * update .github/workflows/release-check.yml * various fixes * stop using deprecated math/rand.Read --------- Co-authored-by: web3-bot <web3-bot@users.noreply.github.com> Co-authored-by: Marten Seemann <martenseemann@gmail.com>
17 lines
274 B
Go
17 lines
274 B
Go
//go:build linux || darwin
|
|
|
|
package rcmgr
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func getNumFDs() int {
|
|
var l unix.Rlimit
|
|
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &l); err != nil {
|
|
log.Errorw("failed to get fd limit", "error", err)
|
|
return 0
|
|
}
|
|
return int(l.Cur)
|
|
}
|