MCPcopy Index your code
hub / github.com/foxcpp/maddy / systemdStatus

Function systemdStatus

systemd.go:79–108  ·  view source on GitHub ↗
(status SDStatus, desc string)

Source from the content-addressed store, hash-verified

77}
78
79func systemdStatus(status SDStatus, desc string) {
80 sock, err := sdNotifySock()
81 if err != nil {
82 if !errors.Is(err, ErrNoNotifySock) {
83 log.Println("systemd: failed to acquire notify socket:", err)
84 }
85 return
86 }
87 defer func() {
88 if err := sock.Close(); err != nil {
89 log.Println("systemd: failed to close systemd socket:", err)
90 }
91 }()
92
93 if err := setScmPassCred(sock); err != nil {
94 log.Println("systemd: failed to set SCM_PASSCRED on the socket:", err)
95 }
96
97 if desc != "" {
98 if _, err := io.WriteString(sock, fmt.Sprintf("%s\nSTATUS=%s", status, desc)); err != nil {
99 log.Println("systemd: I/O error:", err)
100 }
101 log.Debugf(`systemd: %s STATUS="%s"`, status, desc)
102 } else {
103 if _, err := io.WriteString(sock, string(status)); err != nil {
104 log.Println("systemd: I/O error:", err)
105 }
106 log.Debugf(`systemd: %s`, status)
107 }
108}
109
110func systemdStatusErr(reportedErr error) {
111 sock, err := sdNotifySock()

Callers 3

moduleMainFunction · 0.70
moduleReloadFunction · 0.70
handleSignalsFunction · 0.70

Calls 5

PrintlnFunction · 0.92
DebugfFunction · 0.92
sdNotifySockFunction · 0.85
setScmPassCredFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected