github.com/olljanat/moby@v1.13.1/cmd/dockerd/daemon_solaris.go (about)

     1  // +build solaris
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"net"
     8  	"os"
     9  	"path/filepath"
    10  	"syscall"
    11  
    12  	"github.com/docker/docker/libcontainerd"
    13  	"github.com/docker/docker/pkg/system"
    14  )
    15  
    16  const defaultDaemonConfigFile = ""
    17  
    18  // currentUserIsOwner checks whether the current user is the owner of the given
    19  // file.
    20  func currentUserIsOwner(f string) bool {
    21  	if fileInfo, err := system.Stat(f); err == nil && fileInfo != nil {
    22  		if int(fileInfo.UID()) == os.Getuid() {
    23  			return true
    24  		}
    25  	}
    26  	return false
    27  }
    28  
    29  // setDefaultUmask sets the umask to 0022 to avoid problems
    30  // caused by custom umask
    31  func setDefaultUmask() error {
    32  	desiredUmask := 0022
    33  	syscall.Umask(desiredUmask)
    34  	if umask := syscall.Umask(desiredUmask); umask != desiredUmask {
    35  		return fmt.Errorf("failed to set umask: expected %#o, got %#o", desiredUmask, umask)
    36  	}
    37  
    38  	return nil
    39  }
    40  
    41  func getDaemonConfDir(_ string) string {
    42  	return "/etc/docker"
    43  }
    44  
    45  // setupConfigReloadTrap configures the USR2 signal to reload the configuration.
    46  func (cli *DaemonCli) setupConfigReloadTrap() {
    47  }
    48  
    49  // notifySystem sends a message to the host when the server is ready to be used
    50  func notifySystem() {
    51  }
    52  
    53  func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
    54  	opts := []libcontainerd.RemoteOption{}
    55  	if cli.Config.ContainerdAddr != "" {
    56  		opts = append(opts, libcontainerd.WithRemoteAddr(cli.Config.ContainerdAddr))
    57  	} else {
    58  		opts = append(opts, libcontainerd.WithStartDaemon(true))
    59  	}
    60  	return opts
    61  }
    62  
    63  // getLibcontainerdRoot gets the root directory for libcontainerd/containerd to
    64  // store their state.
    65  func (cli *DaemonCli) getLibcontainerdRoot() string {
    66  	return filepath.Join(cli.Config.ExecRoot, "libcontainerd")
    67  }
    68  
    69  // getSwarmRunRoot gets the root directory for swarm to store runtime state
    70  // For example, the control socket
    71  func (cli *DaemonCli) getSwarmRunRoot() string {
    72  	return filepath.Join(cli.Config.ExecRoot, "swarm")
    73  }
    74  
    75  func allocateDaemonPort(addr string) error {
    76  	return nil
    77  }
    78  
    79  // notifyShutdown is called after the daemon shuts down but before the process exits.
    80  func notifyShutdown(err error) {
    81  }
    82  
    83  func wrapListeners(proto string, ls []net.Listener) []net.Listener {
    84  	return ls
    85  }