| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Linux records a child's file-system accesses via a seccomp-user-notifications supervisor and macOS via Detours artifacts + an LD_PRELOAD interposer. FreeBSD has neither facility in this crate, so fspy previously could not be compiled there at all. Add a no-op backend so fspy builds on FreeBSD: the command is spawned and waited on normally, and PathAccessIterable::iter yields no entries. Callers (e.g. vp_command::run_command_with_fspy) keep working on FreeBSD — they simply observe zero path accesses, which is an honest result for a platform without tracing support. The change: - Adds src/freebsd.rs, a SpyImpl that spawns the command via into_tokio_command + tokio::task::spawn_blocking and returns an empty PathAccessIterable, mirroring the async shape of the Linux/macOS backends. - Routes os_impl to freebsd.rs under #[cfg(target_os = "freebsd")] in lib.rs, and gates the ipc and arena modules off FreeBSD. - Gates the Exec import and Command::get_exec/set_exec off FreeBSD in command.rs. - Moves fspy_shared_unix, nix, and fspy_preload_unix behind cfg(all(unix, not(target_os = "freebsd"))) in Cargo.toml, keeping them out of the FreeBSD build graph (and its fspy_nostd/fspy_client_unix subtree). bumpalo and materialized_artifact remain general dependencies since both are pure-Rust and FreeBSD-safe, and materialized_artifact is also used by the Windows backend.
fspy_nostd is the no_std low-level crate that fspy, fspy_shared,
fspy_shm, fspy_ipc_str, and fspy_nostd_alloc all depend on. Its
backends were gated to Linux, macOS, and Windows only, so on FreeBSD the
whole fspy build failed to compile — every one of these crates stopped
at fspy_nostd with "OsCStr"/"Error" undefined. This is the last
compilation blocker for the FreeBSD no-op backend from the accompanying
fspy change.
FreeBSD is a BSD, so rather than duplicating a fourth syscall surface the
crate routes it onto the existing libc-based macOS backends:
- mm (mmap/munmap/mprotect), param::page_size (sysconf), and fd
(close/AT_FDCWD) are API-identical to macOS and now shared.
- fs reuses the macOS openat/unlinkat/fstat/ftruncate backend.
- error::last_os_error uses libc::__error, present on FreeBSD.
Two pieces are Darwin-specific and are handled explicitly:
- F_GETPATH is a macOS fcntl command, so fcntl_getpath and the
F_GETPATH-based getcwd are macOS-only.
- FreeBSD implements getcwd with the standard getcwd(2) call,
normalizing the empty-buffer case to Error::RANGE to match the
macOS contract (FreeBSD reports it as EINVAL).
env and io remain off FreeBSD: their only consumers
(fspy_client_unix/fspy_shared_unix/fspy_preload_unix) are already
excluded from the FreeBSD build by the fspy no-op backend, and the
macOS env implementation relies on _NSGetArgv/_NSGetEnviron, which
FreeBSD does not expose.
Required patches are recorded upstream: voidzero-dev/vite-plus#2537 voidzero-dev/vite-task#698 voidzero-dev/vite-plus#2552
| Back | FazBrowse Home | New Git URL |
Started to add FreeBSD support as mentioned here: voidzero-dev/vite-plus#2537