1
//go:build !(linux || freebsd) || !cgo
9
"github.com/containers/storage/pkg/idtools"
12
// IsRootless returns whether the user is rootless
13
func IsRootless() bool {
15
// os.Geteuid() on Windows returns -1
22
// BecomeRootInUserNS re-exec podman in a new userNS. It returns whether podman was re-executed
23
// into a new user namespace and the return code from the re-executed podman process.
24
// If podman was re-executed the caller needs to propagate the error code returned by the child
25
// process. It is a convenience function for BecomeRootInUserNSWithOpts with a default configuration.
26
func BecomeRootInUserNS(pausePid string) (bool, int, error) {
27
return false, -1, errors.New("this function is not supported on this os")
30
// GetRootlessUID returns the UID of the user in the parent userNS
31
func GetRootlessUID() int {
35
// GetRootlessGID returns the GID of the user in the parent userNS
36
func GetRootlessGID() int {
40
// TryJoinFromFilePaths attempts to join the namespaces of the pid files in paths.
41
// This is useful when there are already running containers and we
42
// don't have a pause process yet. We can use the paths to the conmon
43
// processes to attempt joining their namespaces.
44
// If needNewNamespace is set, the file is read from a temporary user
45
// namespace, this is useful for containers that are running with a
46
// different uidmap and the unprivileged user has no way to read the
47
// file owned by the root in the container.
48
func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []string) (bool, int, error) {
49
return false, -1, errors.New("this function is not supported on this os")
52
// ConfigurationMatches checks whether the additional uids/gids configured for the user
53
// match the current user namespace.
54
func ConfigurationMatches() (bool, error) {
58
// GetConfiguredMappings returns the additional IDs configured for the current user.
59
func GetConfiguredMappings(quiet bool) ([]idtools.IDMap, []idtools.IDMap, error) {
60
return nil, nil, errors.New("this function is not supported on this os")
63
// IsFdInherited checks whether the fd is opened and valid to use
64
func IsFdInherited(fd int) bool {