2015-05-15 19:34:26 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-10 18:35:10 -05:00
|
|
|
"fmt"
|
2016-04-12 11:21:20 -04:00
|
|
|
"net"
|
2015-07-30 15:39:19 -04:00
|
|
|
"os"
|
2016-11-04 15:42:21 -04:00
|
|
|
"path/filepath"
|
2015-12-10 18:35:10 -05:00
|
|
|
"syscall"
|
2015-07-30 15:39:19 -04:00
|
|
|
|
2015-12-10 18:35:10 -05:00
|
|
|
"github.com/Sirupsen/logrus"
|
2016-03-18 14:53:27 -04:00
|
|
|
"github.com/docker/docker/libcontainerd"
|
2015-12-10 18:35:10 -05:00
|
|
|
"github.com/docker/docker/pkg/system"
|
2015-05-15 19:34:26 -04:00
|
|
|
)
|
|
|
|
|
2016-11-04 15:42:21 -04:00
|
|
|
var defaultDaemonConfigFile = ""
|
2015-12-10 18:35:10 -05:00
|
|
|
|
2015-05-15 19:34:26 -04:00
|
|
|
// currentUserIsOwner checks whether the current user is the owner of the given
|
|
|
|
// file.
|
|
|
|
func currentUserIsOwner(f string) bool {
|
|
|
|
return false
|
|
|
|
}
|
2015-06-15 09:36:19 -04:00
|
|
|
|
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
|
|
func setDefaultUmask() error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-07-30 15:39:19 -04:00
|
|
|
|
2016-11-04 15:42:21 -04:00
|
|
|
func getDaemonConfDir(root string) string {
|
|
|
|
return filepath.Join(root, `\config`)
|
2015-07-30 15:39:19 -04:00
|
|
|
}
|
2015-09-23 19:42:08 -04:00
|
|
|
|
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
|
|
func notifySystem() {
|
2016-04-22 20:16:14 -04:00
|
|
|
if service != nil {
|
|
|
|
err := service.started()
|
|
|
|
if err != nil {
|
|
|
|
logrus.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// notifyShutdown is called after the daemon shuts down but before the process exits.
|
|
|
|
func notifyShutdown(err error) {
|
|
|
|
if service != nil {
|
2016-09-19 16:36:33 -04:00
|
|
|
if err != nil {
|
|
|
|
logrus.Fatal(err)
|
|
|
|
}
|
2016-04-22 20:16:14 -04:00
|
|
|
service.stopped(err)
|
|
|
|
}
|
2015-09-23 19:42:08 -04:00
|
|
|
}
|
2015-12-10 18:35:10 -05:00
|
|
|
|
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
2016-04-22 20:16:14 -04:00
|
|
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
2015-12-10 18:35:10 -05:00
|
|
|
go func() {
|
|
|
|
sa := syscall.SecurityAttributes{
|
|
|
|
Length: 0,
|
|
|
|
}
|
|
|
|
ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
|
|
|
|
if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
|
|
|
|
logrus.Debugf("Config reload - waiting signal at %s", ev)
|
|
|
|
for {
|
|
|
|
syscall.WaitForSingleObject(h, syscall.INFINITE)
|
2016-04-22 20:16:14 -04:00
|
|
|
cli.reloadConfig()
|
2015-12-10 18:35:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|
2016-03-18 14:53:27 -04:00
|
|
|
|
|
|
|
func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
|
|
|
|
return nil
|
|
|
|
}
|
2016-03-24 14:42:03 -04:00
|
|
|
|
|
|
|
// getLibcontainerdRoot gets the root directory for libcontainerd to store its
|
|
|
|
// state. The Windows libcontainerd implementation does not need to write a spec
|
|
|
|
// or state to disk, so this is a no-op.
|
|
|
|
func (cli *DaemonCli) getLibcontainerdRoot() string {
|
|
|
|
return ""
|
|
|
|
}
|
2016-04-09 02:49:33 -04:00
|
|
|
|
2016-08-19 16:06:28 -04:00
|
|
|
// getSwarmRunRoot gets the root directory for swarm to store runtime state
|
|
|
|
// For example, the control socket
|
|
|
|
func (cli *DaemonCli) getSwarmRunRoot() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2016-04-09 02:49:33 -04:00
|
|
|
func allocateDaemonPort(addr string) error {
|
|
|
|
return nil
|
|
|
|
}
|
2016-04-12 11:21:20 -04:00
|
|
|
|
|
|
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
|
|
|
return ls
|
|
|
|
}
|