github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/rlimit_freebsd.go (about)

     1  // Copyright 2021 The Sqlite Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package sqlite // import "modernc.org/sqlite"
     6  
     7  import (
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  func setMaxOpenFiles(n int64) error {
    12  	var rLimit unix.Rlimit
    13  	rLimit.Max = n
    14  	rLimit.Cur = n
    15  	return unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit)
    16  }