refactor(fspy): use shared memory IPC on Windows#239
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
0a72112 to
204b6cd
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Windows IPC mechanism for file system access tracking to use shared memory instead of named pipes, aligning it with the Unix implementation. The change consolidates platform-specific code paths, removes the dashmap dependency, and introduces a unified OwnedReceiverLockGuard structure for managing IPC receivers across platforms.
Key Changes:
- Replaced Windows named pipe IPC with shared memory channels
- Unified IPC handling code in a new
ipc.rsmodule shared across platforms - Added
write_encodedmethod toShmWriterfor direct encoding into shared memory
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
crates/fspy_shared/src/windows/mod.rs |
Updated Payload structure to use ChannelConf instead of pipe handle |
crates/fspy_shared/src/ipc/channel/shm_io.rs |
Added write_encoded method and renamed test helper function |
crates/fspy_shared/src/ipc/channel/mod.rs |
Added Windows-specific configuration for raw shared memory |
crates/fspy_shared/Cargo.toml |
Added thiserror dependency |
crates/fspy_preload_windows/src/windows/mod.rs |
Removed cleanup call during DLL detach |
crates/fspy_preload_windows/src/windows/client.rs |
Replaced pipe-based IPC with shared memory sender |
crates/fspy_preload_windows/Cargo.toml |
Removed dashmap dependency |
crates/fspy/src/windows/mod.rs |
Replaced pipe creation and reading with shared memory channel |
crates/fspy/src/unix/mod.rs |
Moved OwnedReceiverLockGuard to shared module |
crates/fspy/src/lib.rs |
Added new ipc module |
crates/fspy/src/ipc.rs |
Created shared IPC module with OwnedReceiverLockGuard |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
789dfb1 to
3be5ec4
Compare
8f35015 to
08ff7a7
Compare
3be5ec4 to
e58577d
Compare
Create named shared memory mappings that can be opened from child processes without backing file access. This fixes rust_std tests on Windows where DLLs injected via Detours need to access the IPC channel. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
21bdcf0 to
92c05a4
Compare
e58577d to
72b1987
Compare
72b1987 to
7d676a0
Compare
Merge activity
|

TL;DR
Replaced Windows pipe-based IPC with shared memory for file system access tracking, unifying the approach across platforms.
What changed?
ipc.rsmodule with common code for both Windows and Unix platformsOwnedReceiverLockGuardfrom Unix implementation to be reused on Windowsdashmapwhich was used for the previous Windows implementationwrite_encodedmethod toShmWriterto directly encode values into shared memoryChannelConfinstead of pipe handlesWhy make this change?
The previous implementation used different IPC mechanisms on Windows (named pipes) and Unix (shared memory). This change unifies the approach across platforms, making the code more maintainable and consistent. Shared memory is more efficient for passing large amounts of data between processes, which is important for tracking file system accesses in complex applications. The unified approach also simplifies the codebase by removing platform-specific code paths and dependencies.