nsenter

package
v0.0.0-...-04f2983 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 32 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CloneFlagsTable = make(map[NSType]int)

CloneFlagsTable is exported so that consumers of this package don't need to define this same table again.

Functions

func NsEnter

func NsEnter(nsList []Namespace, toRun func() error) error

NsEnter executes the passed closure under the given namespace, restoring the original namespace afterwards.

Types

type NSType

type NSType string

NSType defines a namespace type.

const (
	NSTypeCGroup NSType = "cgroup"
	NSTypeIPC    NSType = "ipc"
	NSTypeNet    NSType = "net"
	NSTypePID    NSType = "pid"
	NSTypeUTS    NSType = "uts"
)

List of namespace types. Notice that neither "mnt" nor "user" are listed into this list. Because Golang is multithreaded, we get some errors when trying to switch to those namespaces, getting "invalid argument". The solution is to reexec the current code so that it will call into a C constructor, making sure the namespace can be entered without multithreading issues.

type Namespace

type Namespace struct {
	Path string
	PID  int
	Type NSType
}

Namespace describes a namespace that will be entered.

Jump to

Keyboard shortcuts

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