github.com/rawahars/moby@v24.0.4+incompatible/cmd/dockerd/daemon_windows.go (about)

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