mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std.posix: panic on unexpected error in munmap
This is to help diagnose #25498. We can't use `unexpectedErrno` here, because `std.posix.munmap` is infallible. So, when the flag is set to report unexpected errnos, we just call `std.debug.panic` to provide details instead of doing `unreachable`. Pushing straight to master after running checks locally; there's no point waiting for CI on the PR just for this.
This commit is contained in:
parent
2e31077fe0
commit
923ddd94a1
@ -4991,7 +4991,9 @@ pub fn munmap(memory: []align(page_size_min) const u8) void {
|
||||
.SUCCESS => return,
|
||||
.INVAL => unreachable, // Invalid parameters.
|
||||
.NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping.
|
||||
else => unreachable,
|
||||
else => |e| if (unexpected_error_tracing) {
|
||||
std.debug.panic("unexpected errno: {d} ({t})", .{ @intFromEnum(e), e });
|
||||
} else unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user