a0d0ef5cd8
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
37 lines
631 B
Go
37 lines
631 B
Go
// +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
|
|
}
|