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 onslaveand 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.