mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Revert "std.process: further totalSystemMemory portage"
This reverts commit 5c70d7bc72.
This commit is contained in:
parent
c6ec217e23
commit
70d1bb8049
1 changed files with 3 additions and 8 deletions
|
|
@ -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));
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue