2021-05-21 14:55:42 +03:00
|
|
|
//go:build darwin || netbsd || openbsd
|
2021-06-15 19:42:41 +03:00
|
|
|
// +build darwin netbsd openbsd
|
2021-05-21 14:55:42 +03:00
|
|
|
|
2021-03-16 19:42:15 +03:00
|
|
|
package aghos
|
2020-11-30 19:23:14 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
func canBindPrivilegedPorts() (can bool, err error) {
|
|
|
|
return HaveAdminRights()
|
|
|
|
}
|
|
|
|
|
2021-06-03 21:04:13 +03:00
|
|
|
func setRlimit(val uint64) (err error) {
|
2020-11-30 19:23:14 +03:00
|
|
|
var rlim syscall.Rlimit
|
2021-06-03 21:04:13 +03:00
|
|
|
rlim.Max = val
|
|
|
|
rlim.Cur = val
|
|
|
|
|
|
|
|
return syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlim)
|
2020-11-30 19:23:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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 20:42:04 +03:00
|
|
|
|
|
|
|
func isOpenWrt() (ok bool) {
|
|
|
|
return false
|
|
|
|
}
|