mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-28 18:08:51 +03:00
0182b9ec18
Updates #6158.
Squashed commit of the following:
commit d474a7cb2cdf0a28cf2df320f9095a739241dcc3
Merge: 9c371bde4 53625d891
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Aug 31 17:33:14 2023 +0300
Merge branch 'master' into 6158-fix-service-restart
commit 9c371bde4b32eee7b5b36766095af3d579e14f2c
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Aug 31 16:53:11 2023 +0300
aghos: imp code
commit 2722d38ad51ea6b42caf81bbfc41206c95dac358
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Aug 31 16:29:22 2023 +0300
home: imp code more
commit 50de4c3379cf6e46e5a7cf287381d2b2c3b97127
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Aug 31 16:20:18 2023 +0300
home: imp code
commit dcba579fbe5cb82bea391bd08caee9df82c2618b
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Aug 31 14:57:24 2023 +0300
home: fix service restart for windows
43 lines
725 B
Go
43 lines
725 B
Go
//go:build darwin || freebsd || linux || openbsd
|
|
|
|
package aghos
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"os/signal"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func rootDirFS() (fsys fs.FS) {
|
|
return os.DirFS("/")
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
func sendShutdownSignal(_ chan<- os.Signal) {
|
|
// On Unix we are already notified by the system.
|
|
}
|