commit 70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5 (tree)
parent c6ec217e23243092bf169310182c094c4b8d9bac
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 31 Jul 2023 11:20:21 -0700
Revert "std.process: further totalSystemMemory portage"
This reverts commit 5c70d7bc723a8e0e47018d3606285005c280ddb8.
Diffstat:
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/lib/std/process.zig b/lib/std/process.zig
@@ -1163,17 +1163,12 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {
.linux => {
return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory;
},
- .freebsd, .netbsd, .dragonfly, .macos => {
+ .freebsd => {
var physmem: c_ulong = undefined;
var len: usize = @sizeOf(c_ulong);
- const name = switch (builtin.os.tag) {
- .macos => "hw.memsize",
- .netbsd => "hw.physmem64",
- else => "hw.physmem",
- };
- os.sysctlbynameZ(name, &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,
- else => return error.UnknownTotalSystemMemory,
+ else => |e| return e,
};
return @as(usize, @intCast(physmem));
},