namespace

package
v0.0.0-...-96ac732 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2014 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

+build linux,x86_64

namespace implements low level APIs for moving a process into a given Linux Namespace.

Index

Constants

View Source
const (
	CLONE_NEWNS   = 0x00020000
	CLONE_NEWUTS  = 0x04000000
	CLONE_NEWIPC  = 0x08000000
	CLONE_NEWNET  = 0x40000000
	CLONE_NEWUSER = 0x10000000
	CLONE_NEWPID  = 0x20000000
)

Namespaces

View Source
const (
	SYS_SETNS = 308
)

Variables

View Source
var (
	Types []Namespace
)

Functions

func Close

func Close(fd uintptr) error

Close closes a namespace.

func Open

func Open(nsPath string) (uintptr, error)

Opens the given path and returns the raw file descriptor. The returned fd acts as the handle to the namespace.

func OpenProcess

func OpenProcess(pid int, nstype uintptr) (uintptr, error)

OpenProcess opens a file descriptor for a given pid and type and returns the open fd. The caller is responsible for closing the fd.

func ProcessPath

func ProcessPath(pid int, nstype uintptr) (string, error)

ProcessPath returns the path to a namespace given a target pid and namespace type.

func Setns

func Setns(fd uintptr, nstype uintptr) syscall.Errno

Setns is a wrapper around Syscall for the SYS_SETNS

Types

type Namespace

type Namespace struct {
	Path string
	Type uintptr
}

Jump to

Keyboard shortcuts

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