Skip to main content

Module sysutil

Module sysutil 

Source
Expand description

Unix-only helpers shared by the host CLI and the guest daemon. Unix-only process helpers both the host CLI and the guest daemon need.

Small, dependency-light implementations shared so each of them exists exactly once: the built-in guest cannot be rebuilt for users, but its behaviour tracks the host whenever the helpers agree. Keep this module free of podbox types — it only touches the standard library plus the nix/rustix/signal-hook shims, so the wire-pure core of the crate stays usable from wasm targets (this module is compiled out there).

Functions§

install_shutdown_signal_handler
Register SIGTERM/SIGINT handlers that set the returned flag.
open_pidfd
Open a pidfd for pid (Linux 5.3+).
send_bytes_with_fds
Send data on a Unix stream with file descriptors attached, so the receiver reads both in one message.
wait_child_timeout
Wait for child, SIGKILLing it once timeout has elapsed.
xdg_runtime_dir
$XDG_RUNTIME_DIR, or the fallback every caller re-derived by hand: the uid’s systemd user-runtime directory. Matches how systemd populates the variable for user sessions, so the fallback only ever fires outside one.