package userns

import "github.com/opencontainers/runc/libcontainer/internal/userns"

Index

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
}

Source Files

userns_maps_linux.go usernsfd_linux.go

Version
v1.2.6 (latest)
Published
Mar 14, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
5 minutes ago

Tools for package owners.