github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/cmd/dockerd/daemon_windows.go (about)

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