641db73a86
Merge in DNS/adguard-home from 2231-autoupdate to master Updates #2231. Squashed commit of the following: commit 4ee9148ee7a38f2759898302a2109aa982fb4ee9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 30 19:08:14 2020 +0300 sysutil: provide os-independent interface commit 778097c5fdeb1dec94f4cfc6443d08f92d9db0ba Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 30 16:40:33 2020 +0300 all: add sysutil package
32 lines
910 B
Go
32 lines
910 B
Go
// Package sysutil contains utilities for functions requiring system calls.
|
|
package sysutil
|
|
|
|
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)
|
|
}
|
|
|
|
// ConfigureSyslog reroutes standard logger output to syslog.
|
|
func ConfigureSyslog(serviceName string) error {
|
|
return configureSyslog(serviceName)
|
|
}
|