container_daemon

package
v0.0.0-...-26c8931 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcessRequest = iota
	ProcessResponse
	SignalRequest
	SignalResponse
)
View Source
const (
	RLIMIT_CPU        = syscall.RLIMIT_CPU    // 0
	RLIMIT_FSIZE      = syscall.RLIMIT_FSIZE  // 1
	RLIMIT_DATA       = syscall.RLIMIT_DATA   // 2
	RLIMIT_STACK      = syscall.RLIMIT_STACK  // 3
	RLIMIT_CORE       = syscall.RLIMIT_CORE   // 4
	RLIMIT_RSS        = 5                     // 5
	RLIMIT_NPROC      = 6                     // 6
	RLIMIT_NOFILE     = syscall.RLIMIT_NOFILE // 7
	RLIMIT_MEMLOCK    = 8                     // 8
	RLIMIT_AS         = syscall.RLIMIT_AS     // 9
	RLIMIT_LOCKS      = 10                    // 10
	RLIMIT_SIGPENDING = 11                    // 11
	RLIMIT_MSGQUEUE   = 12                    // 12
	RLIMIT_NICE       = 13                    // 13
	RLIMIT_RTPRIO     = 14                    // 14
	RLIMIT_INFINITY   = ^uint64(0)
)
View Source
const DefaultRootPATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
View Source
const DefaultUserPath = "/usr/local/bin:/usr/bin:/bin"
View Source
const UnknownExitStatus = 255

Variables

This section is empty.

Functions

func Detach

func Detach(redirectStdout, redirectStderr string)

detach detaches from the origin stdin/out/err and makes sure the CWD is no longer inside the original host rootfs

Types

type CmdPreparer

type CmdPreparer interface {
	PrepareCmd(garden.ProcessSpec) (*exec.Cmd, error)
}

type CommandFunc

type CommandFunc func(args ...string) *exec.Cmd

func (CommandFunc) Command

func (fn CommandFunc) Command(args ...string) *exec.Cmd

type Commander

type Commander interface {
	Command(args ...string) *exec.Cmd
}

type ConnectionHandler

type ConnectionHandler interface {
	Handle(decoder *json.Decoder) (*ResponseMessage, error)
}

type Connector

type Connector interface {
	Connect(msg *RequestMessage) (*ResponseMessage, error)
}

type ContainerDaemon

type ContainerDaemon struct {
	CmdPreparer CmdPreparer
	Spawner     Spawner
	Signaller   Signaller
}

func (*ContainerDaemon) Handle

func (cd *ContainerDaemon) Handle(decoder *json.Decoder) (response *ResponseMessage, err error)

func (*ContainerDaemon) Run

func (cd *ContainerDaemon) Run(listener Listener) error

type LibContainerUser

type LibContainerUser struct{}

func (LibContainerUser) Lookup

func (LibContainerUser) Lookup(name string) (*osuser.User, error)

type Listener

type Listener interface {
	Listen(ch ConnectionHandler) error
	Close() error
}

type PTYOpener

type PTYOpener interface {
	Open() (pty *os.File, tty *os.File, err error)
}

type Process

type Process struct {
	Connector    Connector
	ReadSignals  bool
	Term         Term
	SigwinchCh   <-chan os.Signal
	SignalReader io.Reader
	Spec         *garden.ProcessSpec
	IO           *garden.ProcessIO
	// contains filtered or unexported fields
}

func (*Process) Cleanup

func (p *Process) Cleanup()

func (*Process) Signal

func (p *Process) Signal(signal os.Signal) error

func (*Process) Start

func (p *Process) Start() error

func (*Process) Wait

func (p *Process) Wait() (int, error)

type ProcessSignaller

type ProcessSignaller struct {
	Logger lager.Logger
}

func (*ProcessSignaller) Signal

func (ps *ProcessSignaller) Signal(pid int, signal syscall.Signal) error

type ProcessSpecPreparer

type ProcessSpecPreparer struct {
	Users                  User
	Rlimits                RlimitsEnvEncoder
	Reexec                 Commander
	AlwaysDropCapabilities bool
}

func (*ProcessSpecPreparer) PrepareCmd

func (p *ProcessSpecPreparer) PrepareCmd(spec garden.ProcessSpec) (*exec.Cmd, error)

type RequestMessage

type RequestMessage struct {
	Type int
	Data json.RawMessage
}

type ResponseMessage

type ResponseMessage struct {
	Type       int
	Files      []StreamingFile `json:"-"`
	Pid        int
	ErrMessage string
}

type RlimitsEnvEncoder

type RlimitsEnvEncoder interface {
	EncodeLimits(garden.ResourceLimits) string
}

type RlimitsManager

type RlimitsManager struct{}

func (*RlimitsManager) Apply

func (*RlimitsManager) Apply(rlimits garden.ResourceLimits) error

func (*RlimitsManager) DecodeLimits

func (*RlimitsManager) DecodeLimits(encodedLimits string) garden.ResourceLimits

func (*RlimitsManager) EncodeLimits

func (*RlimitsManager) EncodeLimits(rlimits garden.ResourceLimits) string

func (*RlimitsManager) Init

func (mgr *RlimitsManager) Init() error

func (*RlimitsManager) MaxNoFile

func (mgr *RlimitsManager) MaxNoFile() (uint64, error)

type Runner

type Runner interface {
	Start(cmd *exec.Cmd) error
	Wait(cmd *exec.Cmd) byte
}

type SignalSpec

type SignalSpec struct {
	Pid    int
	Signal syscall.Signal
}

type Signaller

type Signaller interface {
	Signal(pid int, signal syscall.Signal) error
}

type Spawn

type Spawn struct {
	PTY    PTYOpener
	Runner Runner
}

func (*Spawn) Spawn

func (w *Spawn) Spawn(cmd *exec.Cmd, tty bool) ([]*os.File, error)

type Spawner

type Spawner interface {
	Spawn(cmd *exec.Cmd, withTty bool) ([]*os.File, error)
}

type StreamingFile

type StreamingFile interface {
	io.ReadWriteCloser
	Fd() uintptr
}

type Term

type Term interface {
	GetWinsize(fd uintptr) (*term.Winsize, error)
	SetWinsize(fd uintptr, size *term.Winsize) error

	SetRawTerminal(fd uintptr) (*term.State, error)
	RestoreTerminal(fd uintptr, state *term.State) error
}

wraps docker/docker/pkg/term for mockability

type TermPkg

type TermPkg struct{}

func (TermPkg) GetWinsize

func (TermPkg) GetWinsize(fd uintptr) (*term.Winsize, error)

func (TermPkg) RestoreTerminal

func (TermPkg) RestoreTerminal(fd uintptr, state *term.State) error

func (TermPkg) SetRawTerminal

func (TermPkg) SetRawTerminal(fd uintptr) (*term.State, error)

func (TermPkg) SetWinsize

func (TermPkg) SetWinsize(fd uintptr, size *term.Winsize) error

type User

type User interface {
	Lookup(name string) (*osuser.User, error)
}

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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