Documentation
¶
Index ¶
- func CreateTarFromSrc(source string, dest string) error
- func ExecCmd(name string, args ...string) (string, error)
- func ExecCmdWithStdStreams(stdin io.Reader, stdout, stderr io.Writer, env []string, name string, ...) error
- func GetCgroupProcess(pid int) (string, error)
- func GetOwnCgroup() (string, error)
- func GetOwnCgroupDisallowRoot() (string, error)
- func GetRandomPort() (int, error)
- func GuardedRemoveAll(path string) error
- func MaybeMoveToSubCgroup() error
- func MovePauseProcessToScope(pausePidPath string)
- func MoveRootlessNetnsSlirpProcessToUserSlice(pid int) error
- func MoveUnderCgroup(cgroup, subtree string, processes []uint32) error
- func MoveUnderCgroupSubtree(subtree string) error
- func ProgressBar(prefix string, size int64, onComplete string) (*mpb.Progress, *mpb.Bar)
- func RemoveScientificNotationFromFloat(x float64) (float64, error)
- func RunUnderSystemdScope(pid int, slice string, unitName string) error
- func RunsOnSystemd() bool
- func Tar(source string) (io.ReadCloser, error)
- func TarChrootToFilesystem(source string, tarball *os.File) error
- func TarToFilesystem(source string, tarball *os.File) error
- func TarWithChroot(source string) (io.ReadCloser, error)
- func UntarToFileSystem(dest string, tarball *os.File, options *archive.TarOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTarFromSrc ¶
Creates a new tar file and wrties bytes from io.ReadCloser
func ExecCmd ¶
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, env []string, name string, args ...string) error
ExecCmdWithStdStreams execute a command with the specified standard streams.
func GetCgroupProcess ¶
GetCgroupProcess returns the cgroup for the specified process process.
func GetOwnCgroup ¶
GetOwnCgroup returns the cgroup for the current process.
func GetOwnCgroupDisallowRoot ¶ added in v4.1.1
func GuardedRemoveAll ¶ added in v4.8.0
GuardedRemoveAll functions much like os.RemoveAll but will not delete certain catastrophic paths.
func MaybeMoveToSubCgroup ¶ added in v4.2.0
func MaybeMoveToSubCgroup() error
MaybeMoveToSubCgroup moves the current process in a sub cgroup when it is running in the root cgroup on a system that uses cgroupv2.
func MovePauseProcessToScope ¶
func MovePauseProcessToScope(pausePidPath string)
MovePauseProcessToScope moves the pause process used for rootless mode to keep the namespaces alive to a separate scope.
func MoveRootlessNetnsSlirpProcessToUserSlice ¶
MoveRootlessNetnsSlirpProcessToUserSlice moves the slirp4netns process for the rootless netns into a different scope so that systemd does not kill it with a container.
func MoveUnderCgroup ¶ added in v4.7.0
MoveUnderCgroup moves a group of processes to a new cgroup. If cgroup is the empty string, then the current calling process cgroup is used. If processes is empty, then the processes from the current cgroup are moved.
func MoveUnderCgroupSubtree ¶
MoveUnderCgroupSubtree moves the PID under a cgroup subtree.
func ProgressBar ¶ added in v4.8.0
func RemoveScientificNotationFromFloat ¶
RemoveScientificNotationFromFloat returns a float without any scientific notation if the number has any. golang does not handle conversion of float64s that have scientific notation in them and otherwise stinks. please replace this if you have a better implementation.
func RunUnderSystemdScope ¶
RunUnderSystemdScope adds the specified pid to a systemd scope
func RunsOnSystemd ¶
func RunsOnSystemd() bool
RunsOnSystemd returns whether the system is using systemd
func Tar ¶
func Tar(source string) (io.ReadCloser, error)
Tar creates a tarball from source and returns a readcloser of it
func TarChrootToFilesystem ¶ added in v4.4.2
TarChrootToFilesystem creates a tarball from source and writes to an os.file provided while chrooted to the source.
func TarToFilesystem ¶
TarToFilesystem creates a tarball from source and writes to an os.file provided
func TarWithChroot ¶ added in v4.4.2
func TarWithChroot(source string) (io.ReadCloser, error)
TarWithChroot creates a tarball from source and returns a readcloser of it while chrooted to the source.
func UntarToFileSystem ¶
UntarToFileSystem untars an os.file of a tarball to a destination in the filesystem
Types ¶
This section is empty.