github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/cmd/dockerd/daemon_windows.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"net"
     6  	"os"
     7  	"path/filepath"
     8  	"syscall"
     9  
    10  	"github.com/Sirupsen/logrus"
    11  	"github.com/docker/docker/libcontainerd"
    12  	"github.com/docker/docker/pkg/system"
    13  )
    14  
    15  var defaultDaemonConfigFile = ""
    16  
    17  // currentUserIsOwner checks whether the current user is the owner of the given
    18  // file.
    19  func currentUserIsOwner(f string) bool {
    20  	return false
    21  }
    22  
    23  // setDefaultUmask doesn't do anything on windows
    24  func setDefaultUmask() error {
    25  	return nil
    26  }
    27  
    28  func getDaemonConfDir(root string) string {
    29  	return filepath.Join(root, `\config`)
    30  }
    31  
    32  // preNotifySystem sends a message to the host when the API is active, but before the daemon is
    33  func preNotifySystem() {
    34  	// start the service now to prevent timeouts waiting for daemon to start
    35  	// but still (eventually) complete all requests that are sent after this
    36  	if service != nil {
    37  		err := service.started()
    38  		if err != nil {
    39  			logrus.Fatal(err)
    40  		}
    41  	}
    42  }
    43  
    44  // notifySystem sends a message to the host when the server is ready to be used
    45  func notifySystem() {
    46  }
    47  
    48  // notifyShutdown is called after the daemon shuts down but before the process exits.
    49  func notifyShutdown(err error) {
    50  	if service != nil {
    51  		if err != nil {
    52  			logrus.Fatal(err)
    53  		}
    54  		service.stopped(err)
    55  	}
    56  }
    57  
    58  // setupConfigReloadTrap configures a Win32 event to reload the configuration.
    59  func (cli *DaemonCli) setupConfigReloadTrap() {
    60  	go func() {
    61  		sa := syscall.SecurityAttributes{
    62  			Length: 0,
    63  		}
    64  		ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
    65  		if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
    66  			logrus.Debugf("Config reload - waiting signal at %s", ev)
    67  			for {
    68  				syscall.WaitForSingleObject(h, syscall.INFINITE)
    69  				cli.reloadConfig()
    70  			}
    71  		}
    72  	}()
    73  }
    74  
    75  func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
    76  	return nil
    77  }
    78  
    79  // getLibcontainerdRoot gets the root directory for libcontainerd to store its
    80  // state. The Windows libcontainerd implementation does not need to write a spec
    81  // or state to disk, so this is a no-op.
    82  func (cli *DaemonCli) getLibcontainerdRoot() string {
    83  	return ""
    84  }
    85  
    86  // getSwarmRunRoot gets the root directory for swarm to store runtime state
    87  // For example, the control socket
    88  func (cli *DaemonCli) getSwarmRunRoot() string {
    89  	return ""
    90  }
    91  
    92  func allocateDaemonPort(addr string) error {
    93  	return nil
    94  }
    95  
    96  func wrapListeners(proto string, ls []net.Listener) []net.Listener {
    97  	return ls
    98  }