std.process.totalSystemMemory: return correct error type on FreeBSD

This commit is contained in:
Kitty-Cricket Piapiac 2023-07-31 22:10:42 -07:00 committed by Andrew Kelley
parent 9e0a34f329
commit d370005d34

View File

@ -1168,7 +1168,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {
var len: usize = @sizeOf(c_ulong); var len: usize = @sizeOf(c_ulong);
os.sysctlbynameZ("hw.physmem", &physmem, &len, null, 0) catch |err| switch (err) { os.sysctlbynameZ("hw.physmem", &physmem, &len, null, 0) catch |err| switch (err) {
error.NameTooLong, error.UnknownName => unreachable, error.NameTooLong, error.UnknownName => unreachable,
else => |e| return e, else => return error.UnknownTotalSystemMemory,
}; };
return @as(usize, @intCast(physmem)); return @as(usize, @intCast(physmem));
}, },