3b87478470
Updates #2439. Squashed commit of the following: commit 3ff109e43751132d77500256c8869938680ac281 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Jun 3 20:46:17 2021 +0300 all: imp code, docs commit 512ee6d78cfee511f429d09c8366bb7dd8019aa8 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Jun 3 20:06:41 2021 +0300 all: openbsd support
35 lines
569 B
Go
35 lines
569 B
Go
// +build darwin netbsd openbsd
|
|
|
|
//go:build darwin || netbsd || openbsd
|
|
|
|
package aghos
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func canBindPrivilegedPorts() (can bool, err error) {
|
|
return HaveAdminRights()
|
|
}
|
|
|
|
func setRlimit(val uint64) (err error) {
|
|
var rlim syscall.Rlimit
|
|
rlim.Max = val
|
|
rlim.Cur = val
|
|
|
|
return syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim)
|
|
}
|
|
|
|
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
|
|
}
|