github.com/devdivbcp/moby@v17.12.0-ce-rc1.0.20200726071732-2d4bfdc789ad+incompatible/cmd/dockerd/daemon_windows.go (about) 1 package main 2 3 import ( 4 "context" 5 "fmt" 6 "net" 7 "os" 8 "path/filepath" 9 "time" 10 11 "github.com/docker/docker/daemon/config" 12 "github.com/docker/docker/libcontainerd/supervisor" 13 "github.com/docker/docker/pkg/system" 14 "github.com/sirupsen/logrus" 15 "golang.org/x/sys/windows" 16 ) 17 18 func getDefaultDaemonConfigFile() (string, error) { 19 return "", nil 20 } 21 22 // setDefaultUmask doesn't do anything on windows 23 func setDefaultUmask() error { 24 return nil 25 } 26 27 func getDaemonConfDir(root string) (string, error) { 28 return filepath.Join(root, `\config`), nil 29 } 30 31 // preNotifySystem sends a message to the host when the API is active, but before the daemon is 32 func preNotifySystem() { 33 // start the service now to prevent timeouts waiting for daemon to start 34 // but still (eventually) complete all requests that are sent after this 35 if service != nil { 36 err := service.started() 37 if err != nil { 38 logrus.Fatal(err) 39 } 40 } 41 } 42 43 // notifySystem sends a message to the host when the server is ready to be used 44 func notifySystem() { 45 } 46 47 // notifyShutdown is called after the daemon shuts down but before the process exits. 48 func notifyShutdown(err error) { 49 if service != nil { 50 if err != nil { 51 logrus.Fatal(err) 52 } 53 service.stopped(err) 54 } 55 } 56 57 func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) { 58 return nil, nil 59 } 60 61 // setupConfigReloadTrap configures a Win32 event to reload the configuration. 62 func (cli *DaemonCli) setupConfigReloadTrap() { 63 go func() { 64 sa := windows.SecurityAttributes{ 65 Length: 0, 66 } 67 event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid()) 68 ev, _ := windows.UTF16PtrFromString(event) 69 if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 { 70 logrus.Debugf("Config reload - waiting signal at %s", event) 71 for { 72 windows.WaitForSingleObject(h, windows.INFINITE) 73 cli.reloadConfig() 74 } 75 } 76 }() 77 } 78 79 // getSwarmRunRoot gets the root directory for swarm to store runtime state 80 // For example, the control socket 81 func (cli *DaemonCli) getSwarmRunRoot() string { 82 return "" 83 } 84 85 func allocateDaemonPort(addr string) error { 86 return nil 87 } 88 89 func wrapListeners(proto string, ls []net.Listener) []net.Listener { 90 return ls 91 } 92 93 func newCgroupParent(config *config.Config) string { 94 return "" 95 } 96 97 func (cli *DaemonCli) initContainerD(_ context.Context) (func(time.Duration) error, error) { 98 system.InitContainerdRuntime(cli.Config.Experimental, cli.Config.ContainerdAddr) 99 return nil, nil 100 }