2021-03-16 19:42:15 +03:00
|
|
|
// Package aghos contains utilities for functions requiring system calls.
|
|
|
|
package aghos
|
2020-11-30 19:23:14 +03:00
|
|
|
|
|
|
|
import "syscall"
|
|
|
|
|
|
|
|
// CanBindPrivilegedPorts checks if current process can bind to privileged
|
|
|
|
// ports.
|
|
|
|
func CanBindPrivilegedPorts() (can bool, err error) {
|
|
|
|
return canBindPrivilegedPorts()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetRlimit sets user-specified limit of how many fd's we can use
|
|
|
|
// https://github.com/AdguardTeam/AdGuardHome/internal/issues/659.
|
|
|
|
func SetRlimit(val uint) {
|
|
|
|
setRlimit(val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// HaveAdminRights checks if the current user has root (administrator) rights.
|
|
|
|
func HaveAdminRights() (bool, error) {
|
|
|
|
return haveAdminRights()
|
|
|
|
}
|
|
|
|
|
|
|
|
// SendProcessSignal sends signal to a process.
|
|
|
|
func SendProcessSignal(pid int, sig syscall.Signal) error {
|
|
|
|
return sendProcessSignal(pid, sig)
|
|
|
|
}
|