Skip to main content

Crate arcbox_pty

Crate arcbox_pty 

Source
Expand description

PTY session primitives shared by ArcBox guest agents.

Both interactive-exec implementations — the sandbox microVM’s vm-agent and the machine-level session in arcbox-agent — need the same subtle, security-relevant steps: allocating a sized PTY, wiring the slave as the child’s controlling terminal, and dropping privileges in the one order that works. This crate is the single home for those steps; everything the consumers legitimately differ on (process reaping, sync vs async pumps, wire framing) stays with them.

Linux-only: on other targets the crate compiles to nothing so host-side workspace builds stay unaffected.

Structs§

PtyPair
An allocated PTY pair. The slave is handed to the child (via child_terminal_setup); the parent keeps the master and must close its slave copy after spawning.
RunAs
Credentials to drop to before exec, resolved via resolve_user.
WinSize
Terminal dimensions in character cells.

Functions§

child_terminal_setup
Builds a pre_exec-compatible closure that turns the child into an interactive session leader on slave and optionally drops privileges.
openpty_sized
Allocates a PTY, optionally applying an initial window size.
resize
Applies a window size to a PTY master (initial or mid-session).
resolve_user
Resolves a username or numeric UID to run-as credentials.