You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
- Add GORM v1.25.12 with MySQL and SQLite drivers - Add Viper v1.19.0 for configuration management - Add UUID package for GORM model IDs - Update vendor directory with new dependencies - Update Go module requirements and checksums 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
973 B
Go
40 lines
973 B
Go
//go:build darwin
|
|
|
|
package internal
|
|
|
|
import (
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
var (
|
|
SyscallEACCES = syscall.EACCES
|
|
UnixEACCES = unix.EACCES
|
|
)
|
|
|
|
var maxfiles uint64
|
|
|
|
// Go 1.19 will do this automatically: https://go-review.googlesource.com/c/go/+/393354/
|
|
func SetRlimit() {
|
|
var l syscall.Rlimit
|
|
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &l)
|
|
if err == nil && l.Cur != l.Max {
|
|
l.Cur = l.Max
|
|
syscall.Setrlimit(syscall.RLIMIT_NOFILE, &l)
|
|
}
|
|
maxfiles = l.Cur
|
|
|
|
if n, err := syscall.SysctlUint32("kern.maxfiles"); err == nil && uint64(n) < maxfiles {
|
|
maxfiles = uint64(n)
|
|
}
|
|
|
|
if n, err := syscall.SysctlUint32("kern.maxfilesperproc"); err == nil && uint64(n) < maxfiles {
|
|
maxfiles = uint64(n)
|
|
}
|
|
}
|
|
|
|
func Maxfiles() uint64 { return maxfiles }
|
|
func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) }
|
|
func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, dev) }
|