| ... | @@ -1314,11 +1314,12 @@ pub fn unmap(mf: *MappedFile) void { | ... | @@ -1314,11 +1314,12 @@ pub fn unmap(mf: *MappedFile) void { |
| 1314 | } | 1314 | } |
| 1315 | | 1315 | |
| 1316 | pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { | 1316 | pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { |
| 1317 | mf.memory_map.write(mf.io) catch |err| switch (err) { | 1317 | mf.flushInner() catch |err| switch (err) { |
| 1318 | error.Canceled => |e| return e, | 1318 | error.Canceled => |e| return e, |
| 1319 | | 1319 | |
| 1320 | error.WouldBlock, // file was not opened as non-blocking | 1320 | error.WouldBlock, // file was not opened as non-blocking |
| 1321 | error.NotOpenForWriting, // we definitely opened the file for writing | 1321 | error.NotOpenForWriting, // we definitely opened the file for writing |
| | 1322 | error.ReadOnlyFileSystem, |
| 1322 | => { | 1323 | => { |
| 1323 | mf.io_err = error.Unexpected; | 1324 | mf.io_err = error.Unexpected; |
| 1324 | return error.MappedFileIo; | 1325 | return error.MappedFileIo; |
| ... | @@ -1331,6 +1332,11 @@ pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { | ... | @@ -1331,6 +1332,11 @@ pub fn flush(mf: *MappedFile) (Io.Cancelable || error{MappedFileIo})!void { |
| 1331 | }; | 1332 | }; |
| 1332 | } | 1333 | } |
| 1333 | | 1334 | |
| | 1335 | fn flushInner(mf: *MappedFile) (Io.File.WritePositionalError || Io.File.SetTimestampsError)!void { |
| | 1336 | try mf.memory_map.write(mf.io); |
| | 1337 | if (is_windows) try mf.memory_map.file.setTimestampsNow(mf.io); |
| | 1338 | } |
| | 1339 | |
| 1334 | fn verify(mf: *MappedFile) void { | 1340 | fn verify(mf: *MappedFile) void { |
| 1335 | const root = Node.Index.root.get(mf); | 1341 | const root = Node.Index.root.get(mf); |
| 1336 | assert(root.parent == .none); | 1342 | assert(root.parent == .none); |