| ... | ... | @@ -16259,6 +16259,7 @@ fn createFileMap( |
| 16259 | 16259 | .SUCCESS => {}, |
| 16260 | 16260 | .FILE_LOCK_CONFLICT => return error.FileLockConflict, |
| 16261 | 16261 | .INVALID_FILE_FOR_SECTION => return error.OperationUnsupported, |
| 16262 | .ACCESS_DENIED => return error.AccessDenied, |
| 16262 | 16263 | else => |status| return windows.unexpectedStatus(status), |
| 16263 | 16264 | } |
| 16264 | 16265 | var contents_ptr: ?[*]align(std.heap.page_size_min) u8 = null; |
| ... | ... | @@ -16280,10 +16281,15 @@ fn createFileMap( |
| 16280 | 16281 | .SECTION_PROTECTION => return error.PermissionDenied, |
| 16281 | 16282 | else => |status| return windows.unexpectedStatus(status), |
| 16282 | 16283 | } |
| 16284 | if (builtin.mode == .Debug) { |
| 16285 | const page_size = std.heap.pageSize(); |
| 16286 | const alignment: Alignment = .fromByteUnits(page_size); |
| 16287 | assert(contents_len == alignment.forward(len)); |
| 16288 | } |
| 16283 | 16289 | return .{ |
| 16284 | 16290 | .file = file, |
| 16285 | 16291 | .offset = offset, |
| 16286 | | .memory = contents_ptr.?[0..contents_len], |
| 16292 | .memory = contents_ptr.?[0..len], |
| 16287 | 16293 | .section = section, |
| 16288 | 16294 | }; |
| 16289 | 16295 | } else if (have_mmap) { |
| ... | ... | @@ -16410,7 +16416,8 @@ fn fileMemoryMapSetLength( |
| 16410 | 16416 | .SECTION_PROTECTION => return error.PermissionDenied, |
| 16411 | 16417 | else => |status| return windows.unexpectedStatus(status), |
| 16412 | 16418 | } |
| 16413 | | mm.memory = contents_ptr.?[0..contents_len]; |
| 16419 | assert(contents_len == alignment.forward(new_len)); |
| 16420 | mm.memory = contents_ptr.?[0..new_len]; |
| 16414 | 16421 | }, |
| 16415 | 16422 | .wasi => unreachable, |
| 16416 | 16423 | .linux => { |
| ... | ... | @@ -16483,15 +16490,15 @@ fn fileMemoryMapSetLength( |
| 16483 | 16490 | fn fileMemoryMapRead(userdata: ?*anyopaque, mm: *File.MemoryMap) File.ReadPositionalError!void { |
| 16484 | 16491 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 16485 | 16492 | _ = t; |
| 16486 | | if (mm.section != null) return; |
| 16487 | | return mmSyncRead(mm.file, mm.memory, mm.offset); |
| 16493 | const section = mm.section orelse return mmSyncRead(mm.file, mm.memory, mm.offset); |
| 16494 | _ = section; |
| 16488 | 16495 | } |
| 16489 | 16496 | |
| 16490 | 16497 | fn fileMemoryMapWrite(userdata: ?*anyopaque, mm: *File.MemoryMap) File.WritePositionalError!void { |
| 16491 | 16498 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 16492 | 16499 | _ = t; |
| 16493 | | if (mm.section != null) return; |
| 16494 | | return mmSyncWrite(mm.file, mm.memory, mm.offset); |
| 16500 | const section = mm.section orelse return mmSyncWrite(mm.file, mm.memory, mm.offset); |
| 16501 | _ = section; |
| 16495 | 16502 | } |
| 16496 | 16503 | |
| 16497 | 16504 | fn mmSyncRead(file: File, memory: []u8, offset: u64) File.ReadPositionalError!void { |