Commit aefb630
committed
NODEFS: hardlinks, utimensat nofollow, and fadvise/fallocate seek errors
Adds a set of filesystem fixes to the legacy (non-WASMFS) JS filesystem,
principally for the NODEFS/NODERAWFS host backends:
* linkat(2): replace the weak `-EMLINK` stub with a real implementation. A
new `FS.link` core op looks up the target and delegates to a backend `link`
node op when present, returning EMLINK for backends without one. Only
NODERAWFS provides it (via `fs.linkSync`); NODEFS deliberately does not, since
a real host hardlink cannot be confined to the mount root (host symlinks in
intermediate path components would escape it), so it reports EMLINK like
MEMFS. AT_SYMLINK_FOLLOW is honored.
* utimensat(2): support AT_SYMLINK_NOFOLLOW instead of asserting `!flags`.
`FS.utime` gains a `dontFollow` argument threaded through `doSetAttr`.
NODERAWFS and NODEFS use `fs.lutimesSync` so a symlink's own timestamps are
set without the host resolving the link (which would otherwise escape the
NODEFS mount root).
* posix_fadvise/posix_fallocate: return ESPIPE on a non-seekable fd (pipe or
socket), matching Linux. `__syscall_fadvise64` moves from a weak C stub to
the JS syscall layer so it can inspect the stream.
* NODERAWFS fstat: defer virtual streams (pipes, sockets) that have no backing
host fd to their own `getattr` rather than calling `fs.fstatSync` on an
undefined nfd.
Adds test/fs coverage across MEMFS/NODEFS/NODERAWFS: test_fs_link,
test_fs_utimensat_nofollow, and test_fs_fadvise_fallocate.1 parent a41c221 commit aefb630
17 files changed
Lines changed: 294 additions & 48 deletions
File tree
- src/lib
- system/lib
- libc
- wasmfs
- test
- codesize
- fs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
858 | 877 | | |
859 | 878 | | |
860 | 879 | | |
| |||
1119 | 1138 | | |
1120 | 1139 | | |
1121 | 1140 | | |
1122 | | - | |
1123 | | - | |
| 1141 | + | |
| 1142 | + | |
1124 | 1143 | | |
1125 | | - | |
1126 | | - | |
| 1144 | + | |
1127 | 1145 | | |
1128 | | - | |
| 1146 | + | |
| 1147 | + | |
1129 | 1148 | | |
1130 | 1149 | | |
1131 | 1150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
102 | 116 | | |
103 | 117 | | |
104 | 118 | | |
| |||
152 | 166 | | |
153 | 167 | | |
154 | 168 | | |
155 | | - | |
| 169 | + | |
156 | 170 | | |
157 | 171 | | |
158 | 172 | | |
159 | 173 | | |
160 | | - | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
164 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
165 | 183 | | |
166 | 184 | | |
167 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
961 | 961 | | |
962 | 962 | | |
963 | 963 | | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
964 | 972 | | |
965 | 973 | | |
966 | 974 | | |
| |||
1009 | 1017 | | |
1010 | 1018 | | |
1011 | 1019 | | |
| 1020 | + | |
1012 | 1021 | | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | 1022 | | |
1017 | 1023 | | |
1018 | 1024 | | |
| |||
1042 | 1048 | | |
1043 | 1049 | | |
1044 | 1050 | | |
1045 | | - | |
| 1051 | + | |
1046 | 1052 | | |
1047 | 1053 | | |
1048 | 1054 | | |
| |||
1055 | 1061 | | |
1056 | 1062 | | |
1057 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
1058 | 1069 | | |
1059 | 1070 | | |
1060 | 1071 | | |
| |||
1064 | 1075 | | |
1065 | 1076 | | |
1066 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1067 | 1087 | | |
1068 | 1088 | | |
1069 | 1089 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 99 | | |
104 | 100 | | |
105 | 101 | | |
| |||
170 | 166 | | |
171 | 167 | | |
172 | 168 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | 169 | | |
179 | 170 | | |
180 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1855 | 1855 | | |
1856 | 1856 | | |
1857 | 1857 | | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
1858 | 1867 | | |
1859 | 1868 | | |
1860 | 1869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2053 | 2053 | | |
2054 | 2054 | | |
2055 | 2055 | | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
2056 | 2077 | | |
2057 | 2078 | | |
2058 | 2079 | | |
| |||
2310 | 2331 | | |
2311 | 2332 | | |
2312 | 2333 | | |
2313 | | - | |
| 2334 | + | |
2314 | 2335 | | |
2315 | | - | |
| 2336 | + | |
2316 | 2337 | | |
2317 | 2338 | | |
2318 | | - | |
2319 | | - | |
| 2339 | + | |
2320 | 2340 | | |
2321 | | - | |
| 2341 | + | |
| 2342 | + | |
2322 | 2343 | | |
2323 | 2344 | | |
2324 | 2345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| 247 | + | |
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
| |||
1751 | 1753 | | |
1752 | 1754 | | |
1753 | 1755 | | |
| 1756 | + | |
1754 | 1757 | | |
1755 | 1758 | | |
1756 | 1759 | | |
| |||
1768 | 1771 | | |
1769 | 1772 | | |
1770 | 1773 | | |
| 1774 | + | |
1771 | 1775 | | |
1772 | 1776 | | |
1773 | 1777 | | |
| |||
2205 | 2209 | | |
2206 | 2210 | | |
2207 | 2211 | | |
2208 | | - | |
2209 | 2212 | | |
2210 | 2213 | | |
2211 | 2214 | | |
| |||
2219 | 2222 | | |
2220 | 2223 | | |
2221 | 2224 | | |
2222 | | - | |
2223 | 2225 | | |
2224 | 2226 | | |
2225 | 2227 | | |
| |||
4090 | 4092 | | |
4091 | 4093 | | |
4092 | 4094 | | |
4093 | | - | |
4094 | 4095 | | |
4095 | 4096 | | |
4096 | 4097 | | |
4097 | 4098 | | |
4098 | 4099 | | |
4099 | 4100 | | |
4100 | | - | |
4101 | 4101 | | |
4102 | 4102 | | |
4103 | 4103 | | |
| |||
4926 | 4926 | | |
4927 | 4927 | | |
4928 | 4928 | | |
| 4929 | + | |
4929 | 4930 | | |
4930 | 4931 | | |
4931 | 4932 | | |
| |||
0 commit comments