daemon_solaris.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // notifySystem sends a message to the host when the server is ready to be used
  40. func notifySystem() {
  41. }
  42. func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
  43. opts := []libcontainerd.RemoteOption{}
  44. if cli.Config.ContainerdAddr != "" {
  45. opts = append(opts, libcontainerd.WithRemoteAddr(cli.Config.ContainerdAddr))
  46. } else {
  47. opts = append(opts, libcontainerd.WithStartDaemon(true))
  48. }
  49. return opts
  50. }
  51. // getLibcontainerdRoot gets the root directory for libcontainerd/containerd to
  52. // store their state.
  53. func (cli *DaemonCli) getLibcontainerdRoot() string {
  54. return filepath.Join(cli.Config.ExecRoot, "libcontainerd")
  55. }
  56. // getSwarmRunRoot gets the root directory for swarm to store runtime state
  57. // For example, the control socket
  58. func (cli *DaemonCli) getSwarmRunRoot() string {
  59. return filepath.Join(cli.Config.ExecRoot, "swarm")
  60. }
  61. func allocateDaemonPort(addr string) error {
  62. return nil
  63. }
  64. // notifyShutdown is called after the daemon shuts down but before the process exits.
  65. func notifyShutdown(err error) {
  66. }
  67. func wrapListeners(proto string, ls []net.Listener) []net.Listener {
  68. return ls
  69. }