mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-17 02:48:28 -07:00
6a8f6357e2
Updates #2829. Squashed commit of the following: commit a284a26ba5df101c78e6f866d1bdfa540d205666 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Apr 8 20:34:20 2021 +0300 aghos: fix darwin commit 9dbd42d75ebb048c83dbd06a1f09d950b3d12181 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Apr 8 20:11:56 2021 +0300 all: mv IsOpenWrt
37 lines
616 B
Go
37 lines
616 B
Go
// +build darwin
|
|
|
|
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
|
|
}
|