File: daemon_windows.go

package info (click to toggle)
docker.io 28.5.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 69,048 kB
  • sloc: sh: 5,867; makefile: 863; ansic: 184; python: 162; asm: 159
file content (119 lines) | stat: -rw-r--r-- 3,209 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package main

import (
	"context"
	"fmt"
	"os"
	"path/filepath"
	"time"

	"github.com/containerd/log"
	"github.com/docker/docker/daemon/config"
	"github.com/docker/docker/pkg/system"
	"golang.org/x/sys/windows"
)

// getDefaultDaemonConfigFile returns the default location of the daemon's
// configuration file.
//
// On Windows, the location of the config-file is relative to the daemon's
// data-root (config.Root), which is configurable, so we cannot use a fixed
// default location, and this function always returns an empty string.
func getDefaultDaemonConfigFile() string {
	return ""
}

// setPlatformOptions applies platform-specific CLI configuration options.
func setPlatformOptions(cfg *config.Config) error {
	if cfg.Pidfile == "" {
		// On Windows, the pid-file location is relative to the daemon's data-root,
		// which is configurable, so we cannot use a fixed default location.
		// Instead, we set the location here, after we parsed command-line flags
		// and loaded the configuration file (if any).
		cfg.Pidfile = filepath.Join(cfg.Root, "docker.pid")
	}
	return nil
}

// setDefaultUmask doesn't do anything on windows
func setDefaultUmask() error {
	return nil
}

// preNotifyReady sends a message to the host when the API is active, but before the daemon is
func preNotifyReady() error {
	// start the service now to prevent timeouts waiting for daemon to start
	// but still (eventually) complete all requests that are sent after this
	if service != nil {
		err := service.started()
		if err != nil {
			return err
		}
	}
	return nil
}

// notifyReady sends a message to the host when the server is ready to be used
func notifyReady() {
}

// notifyStopping sends a message to the host when the server is shutting down
func notifyStopping() {
}

// notifyShutdown is called after the daemon shuts down but before the process exits.
func notifyShutdown(err error) {
	if service != nil {
		service.stopped(err)
	}
}

// setupConfigReloadTrap configures a Win32 event to reload the configuration.
func (cli *daemonCLI) setupConfigReloadTrap() {
	go func() {
		sa := windows.SecurityAttributes{
			Length: 0,
		}
		event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
		ev, _ := windows.UTF16PtrFromString(event)
		if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
			log.G(context.TODO()).Debugf("Config reload - waiting signal at %s", event)
			for {
				windows.WaitForSingleObject(h, windows.INFINITE)
				cli.reloadConfig()
			}
		}
	}()
}

// getSwarmRunRoot gets the root directory for swarm to store runtime state
// For example, the control socket
func getSwarmRunRoot(*config.Config) string {
	return ""
}

func allocateDaemonPort(addr string) error {
	return nil
}

func newCgroupParent(*config.Config) string {
	return ""
}

func (cli *daemonCLI) initContainerd(ctx context.Context) (func(time.Duration) error, error) {
	defer func() { system.EnableContainerdRuntime(cli.Config.ContainerdAddr) }()

	if cli.Config.ContainerdAddr != "" {
		return nil, nil
	}

	if cli.Config.DefaultRuntime != config.WindowsV2RuntimeName {
		return nil, nil
	}

	return cli.initializeContainerd(ctx)
}

func validateCPURealtimeOptions(_ *config.Config) error {
	return nil
}