squib_host/lib.rs
1//! `squib-host` — macOS host-side primitives that back the snapshot subsystem.
2//!
3//! Phase 5.5 lands the Mach-exception-port pager that powers `--mem-backend=Uffd`
4//! and `--mem-backend=File` postcopy restore (per
5//! [16-snapshots.md § 5](../../../specs/16-snapshots.md#5-postcopy--lazy-restore)).
6//! The crate is host-specific: on macOS it wires raw Mach syscalls; elsewhere it
7//! exposes the same trait surface with stub backends so the snapshot crate's tests
8//! still build cross-platform.
9//!
10//! The crate is the `unsafe` boundary alongside `squib-hv` and `squib-net::sys`.
11
12#![warn(missing_docs)]
13// Hardware names (Mach, IPC, mig, EXC_*) and hyphenated nouns are common in the
14// docs; backticking each adds noise.
15#![allow(clippy::doc_markdown)]
16// Boundary modules call into raw FFI; the unsafe-op-in-unsafe-fn lint is what
17// enforces the SAFETY: blocks per CLAUDE.md.
18#![cfg_attr(not(target_os = "macos"), forbid(unsafe_code))]
19#![cfg_attr(target_os = "macos", deny(unsafe_op_in_unsafe_fn))]
20// Sync I/O in tests is fine; the production pager runs on a dedicated `std::thread`
21// and synchronously serves Mach exceptions. The project's `disallowed_methods` lint
22// targets runtime tokio code (per `crates/vmm/src/lib.rs`).
23#![allow(clippy::disallowed_methods, clippy::disallowed_types)]
24// `as usize` for the host page size is safe — Apple Silicon is 64-bit. The static
25// guarantee lives in `host_page_size`; truncation is impossible.
26#![allow(clippy::cast_possible_truncation)]
27
28pub mod block_io;
29pub mod pager;
30
31pub use block_io::set_f_nocache;
32pub use pager::{
33 FilePageSource, PageRequest, PageSource, PageSourceError, Pager, PagerConfig, PagerError,
34 PagerStats, PagerStatsSnapshot, PrewarmList, UffdPageSource, host_page_size, spawn_mach_server,
35};