From 70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 31 Jul 2023 11:20:21 -0700 Subject: [PATCH] Revert "std.process: further totalSystemMemory portage" This reverts commit 5c70d7bc723a8e0e47018d3606285005c280ddb8. --- lib/std/process.zig | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/std/process.zig b/lib/std/process.zig index 28d4bfcb25..c500ac9cf4 100644 --- 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)); },