daemon_windows.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. func (cli *DaemonCli) getPlatformRemoteOptions() ([]libcontainerd.RemoteOption, error) {
  43. return nil, nil
  44. }
  45. // setupConfigReloadTrap configures a Win32 event to reload the configuration.
  46. func (cli *DaemonCli) setupConfigReloadTrap() {
  47. go func() {
  48. sa := windows.SecurityAttributes{
  49. Length: 0,
  50. }
  51. event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
  52. ev, _ := windows.UTF16PtrFromString(event)
  53. if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
  54. logrus.Debugf("Config reload - waiting signal at %s", event)
  55. for {
  56. windows.WaitForSingleObject(h, windows.INFINITE)
  57. cli.reloadConfig()
  58. }
  59. }
  60. }()
  61. }
  62. // getSwarmRunRoot gets the root directory for swarm to store runtime state
  63. // For example, the control socket
  64. func (cli *DaemonCli) getSwarmRunRoot() string {
  65. return ""
  66. }
  67. func allocateDaemonPort(addr string) error {
  68. return nil
  69. }
  70. func wrapListeners(proto string, ls []net.Listener) []net.Listener {
  71. return ls
  72. }