Commit 861e518
authored
refactor(fspy): use shared memory IPC on Windows (#239)
### TL;DR
Replaced Windows pipe-based IPC with shared memory for file system access tracking, unifying the approach across platforms.
### What changed?
- Replaced Windows named pipe IPC with shared memory for tracking file system accesses
- Created a new `ipc.rs` module with common code for both Windows and Unix platforms
- Extracted `OwnedReceiverLockGuard` from Unix implementation to be reused on Windows
- Removed dependency on `dashmap` which was used for the previous Windows implementation
- Added `write_encoded` method to `ShmWriter` to directly encode values into shared memory
- Updated Windows payload structure to use `ChannelConf` instead of pipe handles
### Why 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.1 parent 92c05a4 commit 861e518
12 files changed
Lines changed: 192 additions & 268 deletions
File tree
- crates
- fspy_preload_windows
- src/windows
- fspy/src
- unix
- windows
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | 1 | | |
6 | 2 | | |
7 | 3 | | |
| |||
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
13 | | - | |
14 | 9 | | |
15 | 10 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 11 | + | |
20 | 12 | | |
21 | 13 | | |
22 | 14 | | |
| |||
27 | 19 | | |
28 | 20 | | |
29 | 21 | | |
30 | | - | |
31 | 22 | | |
32 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| |||
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 69 | | |
85 | 70 | | |
86 | 71 | | |
| |||
91 | 76 | | |
92 | 77 | | |
93 | 78 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 79 | + | |
101 | 80 | | |
102 | 81 | | |
103 | 82 | | |
104 | 83 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 84 | | |
111 | 85 | | |
112 | 86 | | |
| |||
170 | 144 | | |
171 | 145 | | |
172 | 146 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 147 | + | |
177 | 148 | | |
178 | 149 | | |
179 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | | - | |
12 | 9 | | |
13 | 10 | | |
14 | 11 | | |
15 | | - | |
| 12 | + | |
16 | 13 | | |
17 | 14 | | |
18 | 15 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 16 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 17 | + | |
| 18 | + | |
32 | 19 | | |
33 | | - | |
34 | 20 | | |
35 | 21 | | |
36 | 22 | | |
37 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
38 | 29 | | |
39 | 30 | | |
40 | 31 | | |
| |||
43 | 34 | | |
44 | 35 | | |
45 | 36 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 37 | | |
56 | | - | |
57 | | - | |
| 38 | + | |
58 | 39 | | |
59 | 40 | | |
60 | | - | |
61 | | - | |
62 | 41 | | |
63 | 42 | | |
64 | | - | |
| 43 | + | |
65 | 44 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 45 | | |
79 | 46 | | |
80 | 47 | | |
| |||
110 | 77 | | |
111 | 78 | | |
112 | 79 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
153 | 87 | | |
154 | 88 | | |
155 | 89 | | |
| |||
163 | 97 | | |
164 | 98 | | |
165 | 99 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 100 | | |
183 | | - | |
| 101 | + | |
184 | 102 | | |
185 | 103 | | |
186 | 104 | | |
| |||
207 | 125 | | |
208 | 126 | | |
209 | 127 | | |
210 | | - | |
211 | 128 | | |
212 | 129 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
0 commit comments