github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/cmd/dockerd/daemon_windows.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  	"os"
     7  	"path/filepath"
     8  	"time"
     9  
    10  	"github.com/demonoid81/moby/daemon/config"
    11  	"github.com/demonoid81/moby/libcontainerd/supervisor"
    12  	"github.com/demonoid81/moby/pkg/system"
    13  	"github.com/sirupsen/logrus"
    14  	"golang.org/x/sys/windows"
    15  )
    16  
    17  func getDefaultDaemonConfigFile() (string, error) {
    18  	return "", nil
    19  }
    20  
    21  // setDefaultUmask doesn't do anything on windows
    22  func setDefaultUmask() error {
    23  	return nil
    24  }
    25  
    26  func getDaemonConfDir(root string) (string, error) {
    27  	return filepath.Join(root, `\config`), nil
    28  }
    29  
    30  // preNotifySystem sends a message to the host when the API is active, but before the daemon is
    31  func preNotifySystem() {
    32  	// start the service now to prevent timeouts waiting for daemon to start
    33  	// but still (eventually) complete all requests that are sent after this
    34  	if service != nil {
    35  		err := service.started()
    36  		if err != nil {
    37  			logrus.Fatal(err)
    38  		}
    39  	}
    40  }
    41  
    42  // notifySystem sends a message to the host when the server is ready to be used
    43  func notifySystem() {
    44  }
    45  
    46  // notifyShutdown is called after the daemon shuts down but before the process exits.
    47  func notifyShutdown(err error) {
    48  	if service != nil {
    49  		if err != nil {
    50  			logrus.Fatal(err)
    51  		}
    52  		service.stopped(err)
    53  	}
    54  }
    55  
    56  func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
    57  	return nil, nil
    58  }
    59  
    60  // setupConfigReloadTrap configures a Win32 event to reload the configuration.
    61  func (cli *DaemonCli) setupConfigReloadTrap() {
    62  	go func() {
    63  		sa := windows.SecurityAttributes{
    64  			Length: 0,
    65  		}
    66  		event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
    67  		ev, _ := windows.UTF16PtrFromString(event)
    68  		if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
    69  			logrus.Debugf("Config reload - waiting signal at %s", event)
    70  			for {
    71  				windows.WaitForSingleObject(h, windows.INFINITE)
    72  				cli.reloadConfig()
    73  			}
    74  		}
    75  	}()
    76  }
    77  
    78  // getSwarmRunRoot gets the root directory for swarm to store runtime state
    79  // For example, the control socket
    80  func (cli *DaemonCli) getSwarmRunRoot() string {
    81  	return ""
    82  }
    83  
    84  func allocateDaemonPort(addr string) error {
    85  	return nil
    86  }
    87  
    88  func newCgroupParent(config *config.Config) string {
    89  	return ""
    90  }
    91  
    92  func (cli *DaemonCli) initContainerD(_ context.Context) (func(time.Duration) error, error) {
    93  	system.InitContainerdRuntime(cli.Config.Experimental, cli.Config.ContainerdAddr)
    94  	return nil, nil
    95  }