gitlab.com/CoiaPrant/sqlite3@v1.19.1/rulimit.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  //go:build linux || darwin || netbsd || openbsd
     6  // +build linux darwin netbsd openbsd
     7  
     8  package sqlite // import "gitlab.com/CoiaPrant/sqlite3"
     9  
    10  import (
    11  	"golang.org/x/sys/unix"
    12  )
    13  
    14  func setMaxOpenFiles(n int64) error {
    15  	var rLimit unix.Rlimit
    16  	rLimit.Max = uint64(n)
    17  	rLimit.Cur = uint64(n)
    18  	return unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit)
    19  }