mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Revert "std.process: further totalSystemMemory portage"
This reverts commit 5c70d7bc723a8e0e47018d3606285005c280ddb8.
This commit is contained in:
parent
c6ec217e23
commit
70d1bb8049
@ -1163,17 +1163,12 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {
|
|||||||
.linux => {
|
.linux => {
|
||||||
return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory;
|
return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory;
|
||||||
},
|
},
|
||||||
.freebsd, .netbsd, .dragonfly, .macos => {
|
.freebsd => {
|
||||||
var physmem: c_ulong = undefined;
|
var physmem: c_ulong = undefined;
|
||||||
var len: usize = @sizeOf(c_ulong);
|
var len: usize = @sizeOf(c_ulong);
|
||||||
const name = switch (builtin.os.tag) {
|
os.sysctlbynameZ("hw.physmem", &physmem, &len, null, 0) catch |err| switch (err) {
|
||||||
.macos => "hw.memsize",
|
|
||||||
.netbsd => "hw.physmem64",
|
|
||||||
else => "hw.physmem",
|
|
||||||
};
|
|
||||||
os.sysctlbynameZ(name, &physmem, &len, null, 0) catch |err| switch (err) {
|
|
||||||
error.NameTooLong, error.UnknownName => unreachable,
|
error.NameTooLong, error.UnknownName => unreachable,
|
||||||
else => return error.UnknownTotalSystemMemory,
|
else => |e| return e,
|
||||||
};
|
};
|
||||||
return @as(usize, @intCast(physmem));
|
return @as(usize, @intCast(physmem));
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user