github.com/portworx/docker@v1.12.1/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  		service.stopped(err)
    45  	}
    46  }
    47  
    48  // setupConfigReloadTrap configures a Win32 event to reload the configuration.
    49  func (cli *DaemonCli) setupConfigReloadTrap() {
    50  	go func() {
    51  		sa := syscall.SecurityAttributes{
    52  			Length: 0,
    53  		}
    54  		ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
    55  		if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
    56  			logrus.Debugf("Config reload - waiting signal at %s", ev)
    57  			for {
    58  				syscall.WaitForSingleObject(h, syscall.INFINITE)
    59  				cli.reloadConfig()
    60  			}
    61  		}
    62  	}()
    63  }
    64  
    65  func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
    66  	return nil
    67  }
    68  
    69  // getLibcontainerdRoot gets the root directory for libcontainerd to store its
    70  // state. The Windows libcontainerd implementation does not need to write a spec
    71  // or state to disk, so this is a no-op.
    72  func (cli *DaemonCli) getLibcontainerdRoot() string {
    73  	return ""
    74  }
    75  
    76  func allocateDaemonPort(addr string) error {
    77  	return nil
    78  }
    79  
    80  func wrapListeners(proto string, ls []net.Listener) []net.Listener {
    81  	return ls
    82  }