Expand description
Process-wide translator state for the single guest-process model.
Hot paths avoid the process RwLock:
- FD map: lock-free atomics (
fd_get/fd_alloc/fd_take) - bottle root: narrow
Arcslot (with_bottle_root) bsdthread_register: atomic pointer snapshot ([bsdthread_reg])
Soft signals and directory streams still use with_mut / with_ref.
Structs§
- Process
State - Owned process state for one guest (or unit-test isolation via reset).
Functions§
- bottle_
dirfd - Process-wide bottle root directory fd for
openat/fstatat(B1). - bottle_
root - Clone of the configured bottle root, if any.
- child_
born - Parent observed a successful
fork(child pid > 0). - child_
reaped - Parent reaped at least one child via
waitpid/wait4. - fd_
alloc - Allocates a guest FD slot for
host_fd(lock-free CAS scan). - fd_get
- Resolve guest FD → host FD without taking the process lock (I/O hot path).
- fd_
guest_ nonblock - Guest-visible
O_NONBLOCKforgfd(stdio or allocated slot). - fd_
install - Installs
host_fdinto a specific guest FD slot (fordup2). - fd_
is_ tls - True when
gfdis a TLS-wrapped guest FD (hot path; no mutex). - fd_
set_ guest_ nonblock - Sets guest-visible
O_NONBLOCKforgfd. - fd_
set_ tls - Mark / clear TLS session association for
gfd(paired withcrate::tls_fd). - fd_take
- Removes a guest FD mapping and returns the host fd (lock-free).
- live_
children - Number of unreaped host children (approximate; for pipe blocking heuristics).
- normalize_
stdio_ pipes_ blocking - Clear host
O_NONBLOCKon stdio when the fd is a pipe/FIFO. - reset_
run - Resets FD/signals/counters for a new guest run (keeps bottle root).
- set_
bottle_ root - Configures the bottle root used by path-taking syscalls.
- stdio_
mark_ open - Clear the closed bit for a stdio slot (after successful
dup2onto 0/1/2). - tick_
syscall - Bumps the process-wide syscall counter without taking the process lock.
- with_
bottle_ root - Borrow the bottle root without cloning (hot path for path translation).
- with_
mut - Exclusive access to the active process state.
- with_
ref - Shared access to the active process state (concurrent FD lookups, etc.).