projects/guix·blob java-team · refs

31 lines · 999 B

1Copyright © 2022 Oleg Pykhalov <[email protected]>
2
3Create a PID file after containerd is ready to serve requests.
4
5Fixes <https://issues.guix.gnu.org/38432>.
6
7--- a/cmd/containerd/command/notify_linux.go 1970-01-01 03:00:01.000000000 +0300
8+++ b/cmd/containerd/command/notify_linux.go 2022-07-02 04:42:35.553753495 +0300
9@@ -22,15 +22,22 @@
10 sd "github.com/coreos/go-systemd/v22/daemon"
11
12 "github.com/containerd/containerd/log"
13+
14+ "os"
15+ "strconv"
16 )
17
18 // notifyReady notifies systemd that the daemon is ready to serve requests
19 func notifyReady(ctx context.Context) error {
20+ pidFile, _ := os.Create("/run/containerd/containerd.pid")
21+ defer pidFile.Close()
22+ pidFile.WriteString(strconv.FormatInt(int64(os.Getpid()), 10))
23 return sdNotify(ctx, sd.SdNotifyReady)
24 }
25
26 // notifyStopping notifies systemd that the daemon is about to be stopped
27 func notifyStopping(ctx context.Context) error {
28+ os.Remove("/run/containerd/containerd.pid")
29 return sdNotify(ctx, sd.SdNotifyStopping)
30 }
31