aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-31 11:20:21 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-31 11:20:21 -0700
commit70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5 (patch)
tree14cab0a8a79d7e3a75fc23733e62fb6d3571aac3 /lib/std/process.zig
parentc6ec217e23243092bf169310182c094c4b8d9bac (diff)
downloadzig-70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5.tar.gz
zig-70d1bb8049b1ac3bbff48c4147bf61e77b7ed7d5.zip
Revert "std.process: further totalSystemMemory portage"
This reverts commit 5c70d7bc723a8e0e47018d3606285005c280ddb8.
Diffstat (limited to 'lib/std/process.zig')
-rw-r--r--lib/std/process.zig11
1 files 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));
},