-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysutil: provide os-independent interface
- Loading branch information
1 parent
778097c
commit 4ee9148
Showing
8 changed files
with
51 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
internal/sysutil/syslog.go → internal/sysutil/syslog_others.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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) | ||
} |