From 43b9426fc68f2336ac1a6cf24d2fca870fa50047 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Fri, 18 Nov 2022 15:17:15 +0000 Subject: [PATCH] cmd/podman, pkg/domain/infra: sockets should live in /var/run on FreeBSD The /var/run directory is the preferred location for unix domain sockets. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson --- cmd/podman/registry/registry.go | 3 --- cmd/podman/registry/registry_common.go | 7 +++++++ cmd/podman/registry/registry_freebsd.go | 4 ++++ pkg/domain/infra/abi/system.go | 2 +- pkg/domain/infra/abi/system_freebsd.go | 4 ++++ pkg/domain/infra/abi/system_linux.go | 4 ++++ 6 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 cmd/podman/registry/registry_common.go create mode 100644 cmd/podman/registry/registry_freebsd.go create mode 100644 pkg/domain/infra/abi/system_freebsd.go create mode 100644 pkg/domain/infra/abi/system_linux.go diff --git a/cmd/podman/registry/registry.go b/cmd/podman/registry/registry.go index 207709ee24..c643a320f5 100644 --- a/cmd/podman/registry/registry.go +++ b/cmd/podman/registry/registry.go @@ -12,9 +12,6 @@ import ( "github.com/spf13/cobra" ) -// DefaultRootAPIPath is the default path of the REST socket -const DefaultRootAPIPath = "/run/podman/podman.sock" - // DefaultRootAPIAddress is the default address of the REST socket with unix: prefix const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath diff --git a/cmd/podman/registry/registry_common.go b/cmd/podman/registry/registry_common.go new file mode 100644 index 0000000000..2b0cdb16f9 --- /dev/null +++ b/cmd/podman/registry/registry_common.go @@ -0,0 +1,7 @@ +//go:build !freebsd +// +build !freebsd + +package registry + +// DefaultRootAPIPath is the default path of the REST socket +const DefaultRootAPIPath = "/run/podman/podman.sock" diff --git a/cmd/podman/registry/registry_freebsd.go b/cmd/podman/registry/registry_freebsd.go new file mode 100644 index 0000000000..3529681a94 --- /dev/null +++ b/cmd/podman/registry/registry_freebsd.go @@ -0,0 +1,4 @@ +package registry + +// DefaultRootAPIPath is the default path of the REST socket +const DefaultRootAPIPath = "/var/run/podman/podman.sock" diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index bc5a90b912..4d2f8c303e 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -35,7 +35,7 @@ func (ic *ContainerEngine) Info(ctx context.Context) (*define.Info, error) { // we are reporting the default systemd activation socket path as we cannot know if a future // service may be run with another URI. if ic.Libpod.RemoteURI() == "" { - xdg := "/run" + xdg := defaultRunPath if path, err := util.GetRuntimeDir(); err != nil { // Info is as good as we can guess... return info, err diff --git a/pkg/domain/infra/abi/system_freebsd.go b/pkg/domain/infra/abi/system_freebsd.go new file mode 100644 index 0000000000..33ccebbb37 --- /dev/null +++ b/pkg/domain/infra/abi/system_freebsd.go @@ -0,0 +1,4 @@ +package abi + +// Default path for system runtime state +const defaultRunPath = "/var/run" diff --git a/pkg/domain/infra/abi/system_linux.go b/pkg/domain/infra/abi/system_linux.go new file mode 100644 index 0000000000..6a13f07050 --- /dev/null +++ b/pkg/domain/infra/abi/system_linux.go @@ -0,0 +1,4 @@ +package abi + +// Default path for system runtime state +const defaultRunPath = "/run"