mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-16 02:18:28 -07:00
Merge: - freebsd: fix build
Close #870 * commit '98ff11e1c781a373768f01c54f6c7c29d8096d32': - freebsd: fix build
This commit is contained in:
commit
df30248870
27
home/os_freebsd.go
Normal file
27
home/os_freebsd.go
Normal file
@ -0,0 +1,27 @@
|
||||
// +build freebsd
|
||||
|
||||
package home
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
)
|
||||
|
||||
// Set user-specified limit of how many fd's we can use
|
||||
// https://github.com/AdguardTeam/AdGuardHome/issues/659
|
||||
func setRlimit(val uint) {
|
||||
var rlim syscall.Rlimit
|
||||
rlim.Max = int64(val)
|
||||
rlim.Cur = int64(val)
|
||||
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim)
|
||||
if err != nil {
|
||||
log.Error("Setrlimit() failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the current user has root (administrator) rights
|
||||
func haveAdminRights() (bool, error) {
|
||||
return os.Getuid() == 0, nil
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly linux netbsd openbsd solaris
|
||||
|
||||
package home
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user