daemon_windows.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package main
  2. import (
  3. "context"
  4. "fmt"
  5. "os"
  6. "time"
  7. "github.com/containerd/log"
  8. "github.com/docker/docker/daemon/config"
  9. "github.com/docker/docker/pkg/system"
  10. "golang.org/x/sys/windows"
  11. )
  12. func getDefaultDaemonConfigFile() (string, error) {
  13. return "", nil
  14. }
  15. // setDefaultUmask doesn't do anything on windows
  16. func setDefaultUmask() error {
  17. return nil
  18. }
  19. // preNotifyReady sends a message to the host when the API is active, but before the daemon is
  20. func preNotifyReady() {
  21. // start the service now to prevent timeouts waiting for daemon to start
  22. // but still (eventually) complete all requests that are sent after this
  23. if service != nil {
  24. err := service.started()
  25. if err != nil {
  26. log.G(context.TODO()).Fatal(err)
  27. }
  28. }
  29. }
  30. // notifyReady sends a message to the host when the server is ready to be used
  31. func notifyReady() {
  32. }
  33. // notifyStopping sends a message to the host when the server is shutting down
  34. func notifyStopping() {
  35. }
  36. // notifyShutdown is called after the daemon shuts down but before the process exits.
  37. func notifyShutdown(err error) {
  38. if service != nil {
  39. if err != nil {
  40. log.G(context.TODO()).Fatal(err)
  41. }
  42. service.stopped(err)
  43. }
  44. }
  45. // setupConfigReloadTrap configures a Win32 event to reload the configuration.
  46. func (cli *DaemonCli) setupConfigReloadTrap() {
  47. go func() {
  48. sa := windows.SecurityAttributes{
  49. Length: 0,
  50. }
  51. event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
  52. ev, _ := windows.UTF16PtrFromString(event)
  53. if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
  54. log.G(context.TODO()).Debugf("Config reload - waiting signal at %s", event)
  55. for {
  56. windows.WaitForSingleObject(h, windows.INFINITE)
  57. cli.reloadConfig()
  58. }
  59. }
  60. }()
  61. }
  62. // getSwarmRunRoot gets the root directory for swarm to store runtime state
  63. // For example, the control socket
  64. func (cli *DaemonCli) getSwarmRunRoot() string {
  65. return ""
  66. }
  67. func allocateDaemonPort(addr string) error {
  68. return nil
  69. }
  70. func newCgroupParent(config *config.Config) string {
  71. return ""
  72. }
  73. func (cli *DaemonCli) initContainerd(_ context.Context) (func(time.Duration) error, error) {
  74. system.InitContainerdRuntime(cli.ContainerdAddr)
  75. return nil, nil
  76. }
  77. func validateCPURealtimeOptions(_ *config.Config) error {
  78. return nil
  79. }