daemon_solaris.go 2.2 KB

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