authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:20:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:20:21-07:00
log70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5
tree14cab0a8a79d7e3a75fc23733e62fb6d3571aac3
parentc6ec217e23243092bf169310182c094c4b8d9bac

Revert "std.process: further totalSystemMemory portage"

This reverts commit 5c70d7bc723a8e0e47018d3606285005c280ddb8.

1 files changed, 3 insertions(+), 8 deletions(-)

lib/std/process.zig+3-8
...@@ -1163,17 +1163,12 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {...@@ -1163,17 +1163,12 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {
1163 .linux => {1163 .linux => {
1164 return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory;1164 return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory;
1165 },1165 },
1166 .freebsd, .netbsd, .dragonfly, .macos => {1166 .freebsd => {
1167 var physmem: c_ulong = undefined;1167 var physmem: c_ulong = undefined;
1168 var len: usize = @sizeOf(c_ulong);1168 var len: usize = @sizeOf(c_ulong);
1169 const name = switch (builtin.os.tag) {1169 os.sysctlbynameZ("hw.physmem", &physmem, &len, null, 0) catch |err| switch (err) {
1170 .macos => "hw.memsize",
1171 .netbsd => "hw.physmem64",
1172 else => "hw.physmem",
1173 };
1174 os.sysctlbynameZ(name, &physmem, &len, null, 0) catch |err| switch (err) {
1175 error.NameTooLong, error.UnknownName => unreachable,1170 error.NameTooLong, error.UnknownName => unreachable,
1176 else => return error.UnknownTotalSystemMemory,1171 else => |e| return e,
1177 };1172 };
1178 return @as(usize, @intCast(physmem));1173 return @as(usize, @intCast(physmem));
1179 },1174 },