2020-12-07 09:48:24 -07:00
|
|
|
// +build freebsd
|
2020-11-30 09:23:14 -07:00
|
|
|
|
2021-03-16 09:42:15 -07:00
|
|
|
package aghos
|
2020-11-30 09:23:14 -07:00
|
|
|
|
|
|
|
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 = int64(val)
|
|
|
|
rlim.Cur = int64(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)
|
|
|
|
}
|
2021-04-08 10:42:04 -07:00
|
|
|
|
|
|
|
func isOpenWrt() (ok bool) {
|
|
|
|
return false
|
|
|
|
}
|