"Fossies" - the Fresh Open Source Software Archive

Member "cri-o-1.25.1/vendor/github.com/containers/podman/v4/pkg/systemd/activation.go" (7 Oct 2022, 579 Bytes) of package /linux/misc/cri-o-1.25.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package systemd
    2 
    3 import (
    4     "os"
    5     "strconv"
    6 )
    7 
    8 // SocketActivated determine if podman is running under the socket activation protocol
    9 // Criteria is based on the expectations of "github.com/coreos/go-systemd/v22/activation"
   10 func SocketActivated() bool {
   11     pid, found := os.LookupEnv("LISTEN_PID")
   12     if !found {
   13         return false
   14     }
   15     p, err := strconv.Atoi(pid)
   16     if err != nil || p != os.Getpid() {
   17         return false
   18     }
   19 
   20     fds, found := os.LookupEnv("LISTEN_FDS")
   21     if !found {
   22         return false
   23     }
   24     nfds, err := strconv.Atoi(fds)
   25     if err != nil || nfds == 0 {
   26         return false
   27     }
   28     return true
   29 }