mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-10 09:40:11 +03:00
Pull request: all: restore netbsd compat
Updates #3147. Squashed commit of the following: commit 4e1bcfd1561f9b927755c5024521d5508ef94b1f Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 17 13:17:51 2021 +0300 all: restore netbsd compat
This commit is contained in:
parent
a031cae447
commit
a0d0ef5cd8
4 changed files with 5 additions and 4 deletions
internal/aghos
36
internal/aghos/os_bsd.go
Normal file
36
internal/aghos/os_bsd.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
// +build darwin netbsd openbsd
|
||||
|
||||
package aghos
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
)
|
||||
|
||||
func canBindPrivilegedPorts() (can bool, err error) {
|
||||
return HaveAdminRights()
|
||||
}
|
||||
|
||||
func setRlimit(val uint) {
|
||||
var rlim syscall.Rlimit
|
||||
rlim.Max = uint64(val)
|
||||
rlim.Cur = uint64(val)
|
||||
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim)
|
||||
if err != nil {
|
||||
log.Error("Setrlimit() failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func haveAdminRights() (bool, error) {
|
||||
return os.Getuid() == 0, nil
|
||||
}
|
||||
|
||||
func sendProcessSignal(pid int, sig syscall.Signal) error {
|
||||
return syscall.Kill(pid, sig)
|
||||
}
|
||||
|
||||
func isOpenWrt() (ok bool) {
|
||||
return false
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue