refactor(fspy-shm): adopt fspy_nostd on Windows - #666
Draft
wan9chi wants to merge 11 commits into
Draft
Conversation
Move Windows file handles, sparse-file operations, and mapped views behind direct no-std Win32 wrappers. Keep the existing fspy_shm public API while removing its production memmap2 and direct windows-sys use. Co-authored-by: GPT-5 Codex <codex@openai.com>
fspy benchmarklinuxmacoswindows |
Mirror the std remove_file fallback to FileDispositionInfoEx when DeleteFileW is denied, so dropping a shared-memory keeper removes the pathname while existing handles remain usable. Co-authored-by: GPT-5 Codex <codex@openai.com>
Replace the policy-heavy map_file helper with one-to-one CreateFileMappingW and MapViewOfFile wrappers. Keep MappingView as the owned RAII view and move shared-memory policy into fspy_shm. Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
Co-authored-by: GPT-5 Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Windows preload opens and maps shared memory before main and under the loader lock, where Rust std lazy initialization is not a dependable foundation. This moves the Windows implementation onto no-std Win32 calls while preserving the existing fspy_shm API.
It is the Windows counterpart to #664: fspy_nostd provides small safe wrappers where it can enforce path, handle, or mapping ownership. fspy_shm calls DeviceIoControl and SetFileInformationByHandle directly because their buffer contracts and flags are specific to its sparse-file, sizing, and removal policy. The outer OsStr and io::Error conversion remains for the later public API migration.