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