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