| ... | @@ -1162,6 +1162,15 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize { | ... | @@ -1162,6 +1162,15 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize { |
| 1162 | .linux => { | 1162 | .linux => { |
| 1163 | return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory; | 1163 | return totalSystemMemoryLinux() catch return error.UnknownTotalSystemMemory; |
| 1164 | }, | 1164 | }, |
| | 1165 | .freebsd => { |
| | 1166 | var physmem: c_ulong = undefined; |
| | 1167 | var len: usize = @sizeOf(c_ulong); |
| | 1168 | os.sysctlbynameZ("hw.physmem", &physmem, &len, null, 0) catch |err| switch (err) { |
| | 1169 | error.NameTooLong, error.UnknownName => unreachable, |
| | 1170 | else => |e| return e, |
| | 1171 | }; |
| | 1172 | return @intCast(usize, physmem); |
| | 1173 | }, |
| 1165 | .windows => { | 1174 | .windows => { |
| 1166 | var sbi: std.os.windows.SYSTEM_BASIC_INFORMATION = undefined; | 1175 | var sbi: std.os.windows.SYSTEM_BASIC_INFORMATION = undefined; |
| 1167 | const rc = std.os.windows.ntdll.NtQuerySystemInformation( | 1176 | const rc = std.os.windows.ntdll.NtQuerySystemInformation( |