daemon_windows.go 2.3 KB

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