AdGuardHome/internal/aghos/os_unix.go

40 lines
625 B
Go
Raw Normal View History

//go:build darwin || freebsd || linux || openbsd
package aghos
import (
2022-12-07 13:46:59 +00:00
"io/fs"
"os"
"os/signal"
"golang.org/x/sys/unix"
)
2022-12-07 13:46:59 +00:00
func rootDirFS() (fsys fs.FS) {
return os.DirFS("/")
}
2022-11-02 13:18:02 +00:00
func notifyReconfigureSignal(c chan<- os.Signal) {
signal.Notify(c, unix.SIGHUP)
}
func notifyShutdownSignal(c chan<- os.Signal) {
signal.Notify(c, unix.SIGINT, unix.SIGQUIT, unix.SIGTERM)
}
2022-11-02 13:18:02 +00:00
func isReconfigureSignal(sig os.Signal) (ok bool) {
return sig == unix.SIGHUP
}
func isShutdownSignal(sig os.Signal) (ok bool) {
switch sig {
case
unix.SIGINT,
unix.SIGQUIT,
unix.SIGTERM:
return true
default:
return false
}
}