daemon_windows.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package main
  2. import (
  3. "fmt"
  4. "net"
  5. "os"
  6. "syscall"
  7. "github.com/Sirupsen/logrus"
  8. "github.com/docker/docker/libcontainerd"
  9. "github.com/docker/docker/pkg/system"
  10. )
  11. var defaultDaemonConfigFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + string(os.PathSeparator) + "config" + string(os.PathSeparator) + "daemon.json"
  12. // currentUserIsOwner checks whether the current user is the owner of the given
  13. // file.
  14. func currentUserIsOwner(f string) bool {
  15. return false
  16. }
  17. // setDefaultUmask doesn't do anything on windows
  18. func setDefaultUmask() error {
  19. return nil
  20. }
  21. func getDaemonConfDir() string {
  22. return os.Getenv("PROGRAMDATA") + `\docker\config`
  23. }
  24. // notifySystem sends a message to the host when the server is ready to be used
  25. func notifySystem() {
  26. if service != nil {
  27. err := service.started()
  28. if err != nil {
  29. logrus.Fatal(err)
  30. }
  31. }
  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. service.stopped(err)
  37. }
  38. }
  39. // setupConfigReloadTrap configures a Win32 event to reload the configuration.
  40. func (cli *DaemonCli) setupConfigReloadTrap() {
  41. go func() {
  42. sa := syscall.SecurityAttributes{
  43. Length: 0,
  44. }
  45. ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
  46. if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
  47. logrus.Debugf("Config reload - waiting signal at %s", ev)
  48. for {
  49. syscall.WaitForSingleObject(h, syscall.INFINITE)
  50. cli.reloadConfig()
  51. }
  52. }
  53. }()
  54. }
  55. func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
  56. return nil
  57. }
  58. // getLibcontainerdRoot gets the root directory for libcontainerd to store its
  59. // state. The Windows libcontainerd implementation does not need to write a spec
  60. // or state to disk, so this is a no-op.
  61. func (cli *DaemonCli) getLibcontainerdRoot() string {
  62. return ""
  63. }
  64. func allocateDaemonPort(addr string) error {
  65. return nil
  66. }
  67. func wrapListeners(proto string, ls []net.Listener) []net.Listener {
  68. return ls
  69. }