daemon_windows.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package main
  2. import (
  3. "fmt"
  4. "net"
  5. "os"
  6. "path/filepath"
  7. "github.com/docker/docker/libcontainerd"
  8. "github.com/sirupsen/logrus"
  9. "golang.org/x/sys/windows"
  10. )
  11. var defaultDaemonConfigFile = ""
  12. // setDefaultUmask doesn't do anything on windows
  13. func setDefaultUmask() error {
  14. return nil
  15. }
  16. func getDaemonConfDir(root string) string {
  17. return filepath.Join(root, `\config`)
  18. }
  19. // preNotifySystem sends a message to the host when the API is active, but before the daemon is
  20. func preNotifySystem() {
  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. logrus.Fatal(err)
  27. }
  28. }
  29. }
  30. // notifySystem sends a message to the host when the server is ready to be used
  31. func notifySystem() {
  32. }
  33. // notifyShutdown is called after the daemon shuts down but before the process exits.
  34. func notifyShutdown(err error) {
  35. if service != nil {
  36. if err != nil {
  37. logrus.Fatal(err)
  38. }
  39. service.stopped(err)
  40. }
  41. }
  42. // setupConfigReloadTrap configures a Win32 event to reload the configuration.
  43. func (cli *DaemonCli) setupConfigReloadTrap() {
  44. go func() {
  45. sa := windows.SecurityAttributes{
  46. Length: 0,
  47. }
  48. ev, _ := windows.UTF16PtrFromString("Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid()))
  49. if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
  50. logrus.Debugf("Config reload - waiting signal at %s", ev)
  51. for {
  52. windows.WaitForSingleObject(h, windows.INFINITE)
  53. cli.reloadConfig()
  54. }
  55. }
  56. }()
  57. }
  58. func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
  59. return nil
  60. }
  61. // getLibcontainerdRoot gets the root directory for libcontainerd to store its
  62. // state. The Windows libcontainerd implementation does not need to write a spec
  63. // or state to disk, so this is a no-op.
  64. func (cli *DaemonCli) getLibcontainerdRoot() string {
  65. return ""
  66. }
  67. // getSwarmRunRoot gets the root directory for swarm to store runtime state
  68. // For example, the control socket
  69. func (cli *DaemonCli) getSwarmRunRoot() string {
  70. return ""
  71. }
  72. func allocateDaemonPort(addr string) error {
  73. return nil
  74. }
  75. func wrapListeners(proto string, ls []net.Listener) []net.Listener {
  76. return ls
  77. }