daemon_windows.go 2.3 KB

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