mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 19:44:01 +08:00
28 lines
540 B
Go
28 lines
540 B
Go
// +build freebsd
|
|
|
|
package util
|
|
|
|
import (
|
|
unix "gx/ipfs/QmPXvegq26x982cQjSfbTvSzZXn7GiaMwhhVPHkeTEhrPT/sys/unix"
|
|
)
|
|
|
|
func init() {
|
|
supportsFDManagement = true
|
|
getLimit = freebsdGetLimit
|
|
setLimit = freebsdSetLimit
|
|
}
|
|
|
|
func freebsdGetLimit() (int64, int64, error) {
|
|
rlimit := unix.Rlimit{}
|
|
err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit)
|
|
return rlimit.Cur, rlimit.Max, err
|
|
}
|
|
|
|
func freebsdSetLimit(soft int64, max int64) error {
|
|
rlimit := unix.Rlimit{
|
|
Cur: soft,
|
|
Max: max,
|
|
}
|
|
return unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
|
|
}
|