Skip to content

Commit

Permalink
freebsd fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hdm committed Aug 13, 2024
1 parent 81fc8dd commit e6cffc1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions cmd/os_freebsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build freebsd

package cmd

import "syscall"

// increaseFileLimit tries to increase our available file limits to the maximum possible
func increaseFileLimit() {
var rLimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
return
}

limits := []int{999999, 99999, 49999, 32766, 9999, 4999, 2048}

for _, l := range limits {
rLimit.Max = int64(l)
rLimit.Cur = int64(l)
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err == nil {
return
}
}
}
2 changes: 1 addition & 1 deletion cmd/os_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
//go:build !windows,!freebsd

package cmd

Expand Down

0 comments on commit e6cffc1

Please sign in to comment.