diff options
| author | Andreas T Jonsson <mail@andreasjonsson.se> | 2024-04-22 10:15:52 +0200 |
|---|---|---|
| committer | Andreas T Jonsson <mail@andreasjonsson.se> | 2024-04-22 10:15:52 +0200 |
| commit | 384137d4e9958044e200f42ac346130bca20b36c (patch) | |
| tree | 41491f237207bbaad92b00e4debf9433a24af31f /src | |
| parent | 1b15d8b4537a8568ddb6eaae5a8ecde383c49d2f (diff) | |
Use PHYSMEM64 on NetBSD
I realize we should use PHYSMEM64 on NetBSD. So we can not share code with FreeBSD.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bug_report.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 2262779c1..0ec383b44 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -250,6 +250,14 @@ gb_internal void report_ram_info() { if (sysctl(mibs, 2, &ram_amount, &val_size, NULL, 0) != -1) { gb_printf("%lld MiB\n", ram_amount / gb_megabytes(1)); } + #elif defined(GB_SYSTEM_NETBSD) + uint64_t ram_amount; + size_t val_size = sizeof(ram_amount); + + int mibs[] = { CTL_HW, HW_PHYSMEM64 }; + if (sysctl(mibs, 2, &ram_amount, &val_size, NULL, 0) != -1) { + gb_printf("%lu MiB\n", ram_amount / gb_megabytes(1)); + } #elif defined(GB_SYSTEM_OPENBSD) uint64_t ram_amount; size_t val_size = sizeof(ram_amount); @@ -258,7 +266,7 @@ gb_internal void report_ram_info() { if (sysctl(mibs, 2, &ram_amount, &val_size, NULL, 0) != -1) { gb_printf("%lld MiB\n", ram_amount / gb_megabytes(1)); } - #elif defined(GB_SYSTEM_FREEBSD) || defined(GB_SYSTEM_NETBSD) + #elif defined(GB_SYSTEM_FREEBSD) uint64_t ram_amount; size_t val_size = sizeof(ram_amount); |