8efed4b270
Change-Id: I507c92c38d45d3d2be3edee08b6b85552ae21c43
23 lines
482 B
Go
23 lines
482 B
Go
// Copyright (C) 2021 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
//go:build linux || darwin || freebsd
|
|
// +build linux darwin freebsd
|
|
|
|
package main
|
|
|
|
import "syscall"
|
|
|
|
// raise RLIMIT_NOFILE softlimit to hardlimit.
|
|
func raiseUlimits() {
|
|
var rLimit syscall.Rlimit
|
|
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if rLimit.Cur < rLimit.Max {
|
|
rLimit.Cur = rLimit.Max
|
|
_ = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
}
|
|
}
|