proc

package
v0.0.0-...-ba09d25 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Overview

Package proc is responsible to manage the communication between the shim and the sandbox process running the container.

Index

Constants

View Source
const RunscRoot = "/run/containerd/runsc"

RunscRoot is the path to the root runsc state directory.

Variables

View Source
var ExitCh = make(chan Exit, bufferSize)

ExitCh is the exit events channel for containers and exec processes inside the sandbox.

Functions

func NewRunsc

func NewRunsc(root, path, namespace, runtime string, config map[string]string) *runsc.Runsc

NewRunsc returns a new runsc instance for a process.

Types

type CreateConfig

type CreateConfig struct {
	ID       string
	Bundle   string
	Runtime  string
	Rootfs   []Mount
	Terminal bool
	Stdin    string
	Stdout   string
	Stderr   string
}

CreateConfig hold task creation configuration.

type ExecConfig

type ExecConfig struct {
	ID       string
	Terminal bool
	Stdin    string
	Stdout   string
	Stderr   string
	Spec     *types.Any
}

ExecConfig holds exec creation configuration.

type Exit

type Exit struct {
	Timestamp time.Time
	ID        string
	Status    int
}

Exit is the type of exit events.

type Init

type Init struct {
	WorkDir string

	Bundle string

	Platform stdio.Platform

	Rootfs  string
	IoUID   int
	IoGID   int
	Sandbox bool
	UserLog string
	Monitor ProcessMonitor
	// contains filtered or unexported fields
}

Init represents an initial process for a container.

func New

func New(id string, runtime *runsc.Runsc, stdio stdio.Stdio) *Init

New returns a new init process.

func (*Init) Create

func (p *Init) Create(ctx context.Context, r *CreateConfig) (err error)

Create the process with the provided config.

func (*Init) Delete

func (p *Init) Delete(ctx context.Context) error

Delete deletes the init process.

func (*Init) Exec

func (p *Init) Exec(ctx context.Context, path string, r *ExecConfig) (process.Process, error)

Exec returns a new child process.

func (*Init) ExitStatus

func (p *Init) ExitStatus() int

ExitStatus returns the exit status of the process.

func (*Init) ExitedAt

func (p *Init) ExitedAt() time.Time

ExitedAt returns the time when the process exited.

func (*Init) ID

func (p *Init) ID() string

ID returns the ID of the process.

func (*Init) Kill

func (p *Init) Kill(ctx context.Context, signal uint32, all bool) error

Kill kills the init process.

func (*Init) KillAll

func (p *Init) KillAll(context context.Context)

KillAll kills all processes belonging to the init process. If `runsc kill --all` returns error, assume the container has already stopped.

func (*Init) Pid

func (p *Init) Pid() int

Pid returns the PID of the process.

func (*Init) Resize

func (p *Init) Resize(ws console.WinSize) error

Resize resizes the init processes console.

func (*Init) Runtime

func (p *Init) Runtime() *runsc.Runsc

Runtime returns the OCI runtime configured for the init process.

func (*Init) SetExited

func (p *Init) SetExited(status int)

SetExited set the exit stauts of the init process.

func (*Init) Start

func (p *Init) Start(ctx context.Context) error

Start starts the init process.

func (*Init) Stats

func (p *Init) Stats(ctx context.Context, id string) (*runc.Stats, error)

func (*Init) Status

func (p *Init) Status(ctx context.Context) (string, error)

Status returns the status of the process.

func (*Init) Stdin

func (p *Init) Stdin() io.Closer

Stdin returns the stdin of the process.

func (*Init) Stdio

func (p *Init) Stdio() stdio.Stdio

Stdio returns the stdio of the process.

func (*Init) Wait

func (p *Init) Wait()

Wait waits for the process to exit.

type Mount

type Mount struct {
	Type    string
	Source  string
	Target  string
	Options []string
}

Mount holds filesystem mount configuration.

type ProcessMonitor

type ProcessMonitor interface {
	// Subscribe to process exit changes
	Subscribe() chan runc.Exit
	// Unsubscribe to process exit changes
	Unsubscribe(c chan runc.Exit)
}

ProcessMonitor monitors process exit changes.

Jump to

Keyboard shortcuts

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