github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/cmd/dockerd/daemon_windows.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"net"
     6  	"os"
     7  	"syscall"
     8  
     9  	"github.com/Sirupsen/logrus"
    10  	"github.com/docker/docker/libcontainerd"
    11  	"github.com/docker/docker/pkg/system"
    12  )
    13  
    14  var defaultDaemonConfigFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + string(os.PathSeparator) + "config" + string(os.PathSeparator) + "daemon.json"
    15  
    16  // currentUserIsOwner checks whether the current user is the owner of the given
    17  // file.
    18  func currentUserIsOwner(f string) bool {
    19  	return false
    20  }
    21  
    22  // setDefaultUmask doesn't do anything on windows
    23  func setDefaultUmask() error {
    24  	return nil
    25  }
    26  
    27  func getDaemonConfDir() string {
    28  	return os.Getenv("PROGRAMDATA") + `\docker\config`
    29  }
    30  
    31  // notifySystem sends a message to the host when the server is ready to be used
    32  func notifySystem() {
    33  	if service != nil {
    34  		err := service.started()
    35  		if err != nil {
    36  			logrus.Fatal(err)
    37  		}
    38  	}
    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  // setupConfigReloadTrap configures a Win32 event to reload the configuration.
    52  func (cli *DaemonCli) setupConfigReloadTrap() {
    53  	go func() {
    54  		sa := syscall.SecurityAttributes{
    55  			Length: 0,
    56  		}
    57  		ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
    58  		if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
    59  			logrus.Debugf("Config reload - waiting signal at %s", ev)
    60  			for {
    61  				syscall.WaitForSingleObject(h, syscall.INFINITE)
    62  				cli.reloadConfig()
    63  			}
    64  		}
    65  	}()
    66  }
    67  
    68  func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
    69  	return nil
    70  }
    71  
    72  // getLibcontainerdRoot gets the root directory for libcontainerd to store its
    73  // state. The Windows libcontainerd implementation does not need to write a spec
    74  // or state to disk, so this is a no-op.
    75  func (cli *DaemonCli) getLibcontainerdRoot() string {
    76  	return ""
    77  }
    78  
    79  // getSwarmRunRoot gets the root directory for swarm to store runtime state
    80  // For example, the control socket
    81  func (cli *DaemonCli) getSwarmRunRoot() string {
    82  	return ""
    83  }
    84  
    85  func allocateDaemonPort(addr string) error {
    86  	return nil
    87  }
    88  
    89  func wrapListeners(proto string, ls []net.Listener) []net.Listener {
    90  	return ls
    91  }