ns

package
v0.6.4-cnv-1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://github.com/torvalds/linux/blob/master/include/uapi/linux/magic.h
	NSFS_MAGIC   = 0x6e736673
	PROCFS_MAGIC = 0x9fa0
)

Variables

This section is empty.

Functions

func IsNSorErr

func IsNSorErr(nspath string) error

func WithNSPath

func WithNSPath(nspath string, toRun func(Namespace) error) error

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

Types

type NSPathNotExistErr

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

func (NSPathNotExistErr) Error

func (e NSPathNotExistErr) Error() string

type NSPathNotNSErr

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

func (NSPathNotNSErr) Error

func (e NSPathNotNSErr) Error() string

type Namespace

type Namespace interface {
	// Executes the passed closure in this object's namespace,
	// attempting to restore the original namespace before returning.
	// No code called from Do() should create go-routines, or the risk
	// of executing code in an incorrect namespace exists.
	Do(toRun func(Namespace) error) error

	// Sets the current namespace to this object's namespace.
	Set() error

	// Returns the filesystem path representing this object's namespace
	Path() string

	// Returns a file descriptor representing this object's namespace
	Fd() uintptr

	// Cleans up this instance of the namespace; if this instance
	// is the last user the namespace will be destroyed
	Close() error
}

func GetNS

func GetNS(nspath string) (Namespace, error)

Returns an object representing the namespace referred to by @path

Jump to

Keyboard shortcuts

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