userns

package
v1.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunningInUserNS = runningInUserNS

RunningInUserNS detects whether we are currently running in a user namespace.

Functions

func GetUserNamespaceMappings

func GetUserNamespaceMappings(nsPath string) (uidMap, gidMap []configs.IDMap, err error)

func IsSameMapping

func IsSameMapping(a, b []configs.IDMap) bool

IsSameMapping returns whether or not the two id mappings are the same. Note that if the order of the mappings is different, or a mapping has been split, the mappings will be considered different.

Types

type Handles

type Handles struct {
	// contains filtered or unexported fields
}

func (*Handles) Get

func (hs *Handles) Get(req Mapping) (file *os.File, err error)

Get returns a handle to a /proc/$pid/ns/user nsfs file with the requested mapping. The processes spawned to produce userns nsfds are cached, so if equivalent user namespace mappings are requested, the same user namespace will be returned. The caller is responsible for closing the returned file descriptor.

func (*Handles) Release

func (hs *Handles) Release()

Release all resources associated with this Handle. All existing files returned from Get() will continue to work even after calling Release(). The same Handles can be re-used after calling Release().

type Mapping

type Mapping struct {
	UIDMappings []configs.IDMap
	GIDMappings []configs.IDMap
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL