1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 02:05:59 +01:00
galene/limit/limit_unix.go
Juliusz Chroboczek 90a0a2e318 Don't attempt to set file descriptor limit.
Recent versions of Go do it at startup, so only print
a warning if the limit is too low.
2024-05-27 00:02:31 +02:00

18 lines
246 B
Go

//go:build unix
package limit
import (
"golang.org/x/sys/unix"
)
func Nofile() (uint64, error) {
var limit unix.Rlimit
err := unix.Getrlimit(unix.RLIMIT_NOFILE, &limit)
if err != nil {
return 0, err
}
return uint64(limit.Cur), nil
}