mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
90a0a2e318
Recent versions of Go do it at startup, so only print a warning if the limit is too low.
18 lines
246 B
Go
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
|
|
}
|