github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/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/libcontainerd"
    10  	"github.com/sirupsen/logrus"
    11  	"golang.org/x/sys/windows"
    12  )
    13  
    14  var defaultDaemonConfigFile = ""
    15  
    16  // setDefaultUmask doesn't do anything on windows
    17  func setDefaultUmask() error {
    18  	return nil
    19  }
    20  
    21  func getDaemonConfDir(root string) string {
    22  	return filepath.Join(root, `\config`)
    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) getPlatformRemoteOptions() ([]libcontainerd.RemoteOption, 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  }