cmd/uplink: raise fd limits
Change-Id: I507c92c38d45d3d2be3edee08b6b85552ae21c43
This commit is contained in:
parent
5cebbdee03
commit
8efed4b270
@ -17,6 +17,7 @@ import (
|
||||
|
||||
func main() {
|
||||
ex := newExternal()
|
||||
raiseUlimits()
|
||||
ok, err := clingy.Environment{
|
||||
Name: "uplink",
|
||||
Args: os.Args[1:],
|
||||
|
22
cmd/uplink/ulimit.go
Normal file
22
cmd/uplink/ulimit.go
Normal file
@ -0,0 +1,22 @@
|
||||
// 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)
|
||||
}
|
||||
}
|
11
cmd/uplink/ulimit_other.go
Normal file
11
cmd/uplink/ulimit_other.go
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2021 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
//go:build !linux && !darwin && !freebsd
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package main
|
||||
|
||||
func raiseUlimits() {
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user