github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/cmd/dockerd/daemon_windows.go (about)

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