unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 668ffcd9e9fe1c530ed09fd0d34971bb6594aba1 999 bytes (raw)
name: packages/patches/containerd-create-pid-file.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>

Create a PID file after containerd is ready to serve requests.

Fixes <https://issues.guix.gnu.org/38432>.

--- a/cmd/containerd/command/notify_linux.go	1970-01-01 03:00:01.000000000 +0300
+++ b/cmd/containerd/command/notify_linux.go	2022-07-02 04:42:35.553753495 +0300
@@ -22,15 +22,22 @@
 	sd "github.com/coreos/go-systemd/v22/daemon"
 
 	"github.com/containerd/containerd/log"
+
+	"os"
+	"strconv"
 )
 
 // notifyReady notifies systemd that the daemon is ready to serve requests
 func notifyReady(ctx context.Context) error {
+	pidFile, _ := os.Create("/run/containerd/containerd.pid")
+	defer pidFile.Close()
+	pidFile.WriteString(strconv.FormatInt(int64(os.Getpid()), 10))
 	return sdNotify(ctx, sd.SdNotifyReady)
 }
 
 // notifyStopping notifies systemd that the daemon is about to be stopped
 func notifyStopping(ctx context.Context) error {
+	os.Remove("/run/containerd/containerd.pid")
 	return sdNotify(ctx, sd.SdNotifyStopping)
 }
 

debug log:

solving 668ffcd9e9fe1c530ed09fd0d34971bb6594aba1 ...
found 668ffcd9e9fe1c530ed09fd0d34971bb6594aba1 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).