daemon_windows.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. // notifySystem sends a message to the host when the server is ready to be used
  26. func notifySystem() {
  27. if service != nil {
  28. err := service.started()
  29. if err != nil {
  30. logrus.Fatal(err)
  31. }
  32. }
  33. }
  34. // notifyShutdown is called after the daemon shuts down but before the process exits.
  35. func notifyShutdown(err error) {
  36. if service != nil {
  37. if err != nil {
  38. logrus.Fatal(err)
  39. }
  40. service.stopped(err)
  41. }
  42. }
  43. // setupConfigReloadTrap configures a Win32 event to reload the configuration.
  44. func (cli *DaemonCli) setupConfigReloadTrap() {
  45. go func() {
  46. sa := syscall.SecurityAttributes{
  47. Length: 0,
  48. }
  49. ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
  50. if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
  51. logrus.Debugf("Config reload - waiting signal at %s", ev)
  52. for {
  53. syscall.WaitForSingleObject(h, syscall.INFINITE)
  54. cli.reloadConfig()
  55. }
  56. }
  57. }()
  58. }
  59. func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
  60. return nil
  61. }
  62. // getLibcontainerdRoot gets the root directory for libcontainerd to store its
  63. // state. The Windows libcontainerd implementation does not need to write a spec
  64. // or state to disk, so this is a no-op.
  65. func (cli *DaemonCli) getLibcontainerdRoot() string {
  66. return ""
  67. }
  68. // getSwarmRunRoot gets the root directory for swarm to store runtime state
  69. // For example, the control socket
  70. func (cli *DaemonCli) getSwarmRunRoot() string {
  71. return ""
  72. }
  73. func allocateDaemonPort(addr string) error {
  74. return nil
  75. }
  76. func wrapListeners(proto string, ls []net.Listener) []net.Listener {
  77. return ls
  78. }