3d6f5984f5
BenchmarkWithHack-4 50000 37082 ns/op 44.50 MB/s 1920 B/op 30 allocs/op BenchmarkNoHack-4 50000 30829 ns/op 53.52 MB/s 0 B/op 0 allocs/op Signed-off-by: Brian Goff <cpuguy83@gmail.com> Signed-off-by: Antonio Murdaca <runcom@redhat.com>
82 lines
2 KiB
Go
82 lines
2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"os"
|
|
"syscall"
|
|
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/docker/docker/libcontainerd"
|
|
"github.com/docker/docker/pkg/system"
|
|
)
|
|
|
|
var defaultDaemonConfigFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + string(os.PathSeparator) + "config" + string(os.PathSeparator) + "daemon.json"
|
|
|
|
// currentUserIsOwner checks whether the current user is the owner of the given
|
|
// file.
|
|
func currentUserIsOwner(f string) bool {
|
|
return false
|
|
}
|
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
func setDefaultUmask() error {
|
|
return nil
|
|
}
|
|
|
|
func getDaemonConfDir() string {
|
|
return os.Getenv("PROGRAMDATA") + `\docker\config`
|
|
}
|
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
func notifySystem() {
|
|
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 {
|
|
service.stopped(err)
|
|
}
|
|
}
|
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
|
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)
|
|
cli.reloadConfig()
|
|
}
|
|
}
|
|
}()
|
|
}
|
|
|
|
func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
|
|
return nil
|
|
}
|
|
|
|
// 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 ""
|
|
}
|
|
|
|
func allocateDaemonPort(addr string) error {
|
|
return nil
|
|
}
|
|
|
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
|
return ls
|
|
}
|