github.com/rish1988/moby@v25.0.2+incompatible/cmd/dockerd/daemon_windows.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  	"os"
     7  	"time"
     8  
     9  	"github.com/containerd/log"
    10  	"github.com/docker/docker/daemon/config"
    11  	"github.com/docker/docker/pkg/system"
    12  	"golang.org/x/sys/windows"
    13  )
    14  
    15  func getDefaultDaemonConfigFile() (string, error) {
    16  	return "", nil
    17  }
    18  
    19  // loadCLIPlatformConfig loads the platform specific CLI configuration
    20  // there is none on windows, so this is a no-op
    21  func loadCLIPlatformConfig(conf *config.Config) error {
    22  	return nil
    23  }
    24  
    25  // setDefaultUmask doesn't do anything on windows
    26  func setDefaultUmask() error {
    27  	return 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  			log.G(context.TODO()).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  			log.G(context.TODO()).Fatal(err)
    55  		}
    56  		service.stopped(err)
    57  	}
    58  }
    59  
    60  // setupConfigReloadTrap configures a Win32 event to reload the configuration.
    61  func (cli *DaemonCli) setupConfigReloadTrap() {
    62  	go func() {
    63  		sa := windows.SecurityAttributes{
    64  			Length: 0,
    65  		}
    66  		event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
    67  		ev, _ := windows.UTF16PtrFromString(event)
    68  		if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
    69  			log.G(context.TODO()).Debugf("Config reload - waiting signal at %s", event)
    70  			for {
    71  				windows.WaitForSingleObject(h, windows.INFINITE)
    72  				cli.reloadConfig()
    73  			}
    74  		}
    75  	}()
    76  }
    77  
    78  // getSwarmRunRoot gets the root directory for swarm to store runtime state
    79  // For example, the control socket
    80  func (cli *DaemonCli) getSwarmRunRoot() string {
    81  	return ""
    82  }
    83  
    84  func allocateDaemonPort(addr string) error {
    85  	return nil
    86  }
    87  
    88  func newCgroupParent(config *config.Config) string {
    89  	return ""
    90  }
    91  
    92  func (cli *DaemonCli) initContainerd(_ context.Context) (func(time.Duration) error, error) {
    93  	system.InitContainerdRuntime(cli.ContainerdAddr)
    94  	return nil, nil
    95  }
    96  
    97  func validateCPURealtimeOptions(_ *config.Config) error {
    98  	return nil
    99  }