utils

package
v1.16.5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: Apache-2.0 Imports: 20 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDetachable added in v1.0.0

func CopyDetachable(dst io.Writer, src io.Reader, keys []byte) (written int64, err error)

CopyDetachable is similar to io.Copy but support a detach key sequence to break out.

func ExecCmd

func ExecCmd(name string, args ...string) (string, error)

ExecCmd executes a command with args and returns its output as a string along with an error, if any

func ExecCmdWithStdStreams

func ExecCmdWithStdStreams(stdin io.Reader, stdout, stderr io.Writer, name string, args ...string) error

ExecCmdWithStdStreams execute a command with the specified standard streams.

func GenerateID added in v1.13.7

func GenerateID() (string, error)

GenerateID generates a random unique id.

func GeneratePasswd added in v1.13.7

func GeneratePasswd(username string, uid, gid uint32, homedir, rootfs, rundir string) (string, error)

GeneratePasswd generates a container specific passwd file, iff uid is not defined in the containers /etc/passwd

func GetDiskUsageStats added in v1.9.11

func GetDiskUsageStats(path string) (dirSize, inodeCount uint64, err error)

GetDiskUsageStats accepts a path to a directory or file and returns the number of bytes and inodes used by the path

func GetUserInfo added in v1.13.7

func GetUserInfo(rootfs, userName string) (uid, gid uint32, additionalGids []uint32, err error)

GetUserInfo returns UID, GID and additional groups for specified user by looking them up in /etc/passwd and /etc/group

func Int32Ptr added in v1.16.2

func Int32Ptr(i int32) *int32

Int32Ptr is a utility function to assign to integer pointer variables

func IsDirectory added in v1.14.5

func IsDirectory(path string) error

IsDirectory tests whether the given path exists and is a directory. It follows symlinks.

func RunUnderSystemdScope added in v1.0.0

func RunUnderSystemdScope(pid int, slice, unitName string) error

RunUnderSystemdScope adds the specified pid to a systemd scope

func StatusToExitCode

func StatusToExitCode(status int) int

StatusToExitCode converts wait status code to an exit code

func WriteGoroutineStacks added in v1.11.7

func WriteGoroutineStacks(w io.Writer) error

WriteGoroutineStacks writes out the goroutine stacks of the caller. Up to 32 MB is allocated to print the stack.

func WriteGoroutineStacksToFile added in v1.11.7

func WriteGoroutineStacksToFile(path string) error

WriteGoroutineStacksToFile write goroutine stacks to the specified file.

Types

type DetachError added in v1.0.0

type DetachError struct{}

DetachError is special error which returned in case of container detach.

func (DetachError) Error added in v1.0.0

func (DetachError) Error() string

Directories

Path Synopsis
Package errdefs defines the common errors used throughout containerd packages.
Package errdefs defines the common errors used throughout containerd packages.

Jump to

Keyboard shortcuts

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