package namespaces

import "github.com/docker/libcontainer/namespaces"

Index

Variables

var (
	ErrUnkownNamespace = errors.New("Unknown namespace")
	ErrUnsupported     = errors.New("Unsupported method")
)

namespaceList is used to convert the libcontainer types into the names of the files located in /proc/<pid>/ns/* for each namespace

Functions

func Exec

func Exec(container *libcontainer.Config, term Terminal, rootfs, dataPath string, args []string, createCommand CreateCommand, startCallback func()) (int, error)

func GetNamespaceFlags

func GetNamespaceFlags(namespaces map[string]bool) (flag int)

func Init

func Init(container *libcontainer.Config, uncleanRootfs, consolePath string, syncPipe *SyncPipe, args []string) error

func InitializeNetworking

func InitializeNetworking(container *libcontainer.Config, nspid int, pipe *SyncPipe) error

func SetupCgroups

func SetupCgroups(container *libcontainer.Config, nspid int) (cgroups.ActiveCgroup, error)

Types

type CreateCommand

type CreateCommand func(container *libcontainer.Config, console, rootfs, dataPath, init string, childPipe *os.File, args []string) *exec.Cmd

type Namespace

type Namespace struct {
	Key   string `json:"key,omitempty"`
	Value int    `json:"value,omitempty"`
	File  string `json:"file,omitempty"`
}

func GetNamespace

func GetNamespace(key string) *Namespace

func (*Namespace) String

func (ns *Namespace) String() string

type Namespaces

type Namespaces []*Namespace

func (Namespaces) Contains

func (n Namespaces) Contains(ns string) bool

Contains returns true if the specified Namespace is in the slice

func (Namespaces) Get

func (n Namespaces) Get(ns string) *Namespace

type StdTerminal

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

func (*StdTerminal) Attach

func (s *StdTerminal) Attach(command *exec.Cmd) error

func (*StdTerminal) Close

func (s *StdTerminal) Close() error

func (*StdTerminal) Resize

func (s *StdTerminal) Resize(h, w int) error

func (*StdTerminal) SetMaster

func (s *StdTerminal) SetMaster(*os.File)

type SyncPipe

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

SyncPipe allows communication to and from the child processes to it's parent and allows the two independent processes to syncronize their state.

func NewSyncPipeFromFd

func NewSyncPipeFromFd(parentFd, childFd uintptr) (*SyncPipe, error)

func (*SyncPipe) Child

func (s *SyncPipe) Child() *os.File

func (*SyncPipe) Close

func (s *SyncPipe) Close() error

func (*SyncPipe) CloseChild

func (s *SyncPipe) CloseChild()

func (*SyncPipe) Parent

func (s *SyncPipe) Parent() *os.File

func (*SyncPipe) ReadFromChild

func (s *SyncPipe) ReadFromChild() error

func (*SyncPipe) ReadFromParent

func (s *SyncPipe) ReadFromParent() (*network.NetworkState, error)

func (*SyncPipe) ReportChildError

func (s *SyncPipe) ReportChildError(err error)

func (*SyncPipe) SendToChild

func (s *SyncPipe) SendToChild(networkState *network.NetworkState) error

type Terminal

type Terminal interface {
	io.Closer
	SetMaster(*os.File)
	Attach(*exec.Cmd) error
	Resize(h, w int) error
}

func NewTerminal

func NewTerminal(stdin io.Reader, stdout, stderr io.Writer, tty bool) Terminal

type TtyTerminal

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

func (*TtyTerminal) Attach

func (t *TtyTerminal) Attach(command *exec.Cmd) error

func (*TtyTerminal) Close

func (t *TtyTerminal) Close() error

func (*TtyTerminal) Resize

func (t *TtyTerminal) Resize(h, w int) error

func (*TtyTerminal) SetMaster

func (t *TtyTerminal) SetMaster(master *os.File)

Source Files

create.go std_term.go sync_pipe.go term.go tty_term.go types.go unsupported.go

Version
v1.1.0
Published
Jun 26, 2014
Platform
windows/amd64
Imports
12 packages
Last checked
1 minute ago

Tools for package owners.