gvisorgvisor.dev/gvisor/tools/embeddedbinary Index | Files | Directories

package embeddedbinary

import "gvisor.dev/gvisor/tools/embeddedbinary"

Package embeddedbinary embeds an external binary and provides a function to exec it.

flatecompress compresses data from stdin and writes it to stdout with flate.

Index

Constants

const BinaryName = "embedded.bin.name"

BinaryName is the name of the embedded binary.

Functions

func Exec

func Exec(options Options) error

Exec execs the embedded binary. The current process is replaced. This function only returns if unsuccessful.

func ForkExec

func ForkExec(options Options) (int, error)

ForkExec runs the embedded binary in a separate process. Returns the PID of the child process.

Types

type Options

type Options struct {
	// Argv is the set of arguments to exec with.
	// `Argv[0]` is the name of the binary as invoked.
	// If Argv is empty, it will default to a single-element slice, with
	// `Argv[0]` being the binary name.
	Argv []string

	// Envv is the set of environment variables to pass to the executed process.
	Envv []string

	// Files is the set of file descriptors to pass to forked processes.
	// Only used when forking, not pure exec'ing.
	Files []uintptr
}

Options is the set of options to execute the embedded binary.

Source Files

embeddedbinary_template.go flatecompress.go

Directories

PathSynopsis
tools/embeddedbinary/testhelloworld_bundler bundles helloworld_bundlee and executes it.
tools/embeddedbinary/test/helloworldhelloworld_bundlee writes "Hello, gVisor!\n" to stdout.
Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
4 hours ago

Tools for package owners.