github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/cmd/dockerd/daemon_linux.go (about)

     1  package main
     2  
     3  import (
     4  	cdcgroups "github.com/containerd/cgroups"
     5  	systemdDaemon "github.com/coreos/go-systemd/v22/daemon"
     6  	"github.com/docker/docker/daemon/config"
     7  	"github.com/docker/docker/pkg/sysinfo"
     8  	"github.com/pkg/errors"
     9  )
    10  
    11  // preNotifyReady sends a message to the host when the API is active, but before the daemon is
    12  func preNotifyReady() {
    13  }
    14  
    15  // notifyReady sends a message to the host when the server is ready to be used
    16  func notifyReady() {
    17  	// Tell the init daemon we are accepting requests
    18  	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
    19  }
    20  
    21  // notifyStopping sends a message to the host when the server is shutting down
    22  func notifyStopping() {
    23  	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
    24  }
    25  
    26  func validateCPURealtimeOptions(config *config.Config) error {
    27  	if config.CPURealtimePeriod == 0 && config.CPURealtimeRuntime == 0 {
    28  		return nil
    29  	}
    30  	if cdcgroups.Mode() == cdcgroups.Unified {
    31  		return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not implemented for cgroup v2")
    32  	}
    33  	if !sysinfo.New().CPURealtime {
    34  		return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not supported by the kernel")
    35  	}
    36  	return nil
    37  }