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