From 5676c9e7ebcec9af526c59ece1faf2e8b15e457c Mon Sep 17 00:00:00 2001 From: Sébastien Marie Date: Fri, 25 Feb 2022 08:49:25 +0000 Subject: initial OpenBSD support --- src/bug_report.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/bug_report.cpp') diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 4dd251f24..7f6b668e8 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -17,6 +17,10 @@ #include #endif +#if defined(GB_SYSTEM_OPENBSD) + #include +#endif + /* NOTE(Jeroen): This prints the Windows product edition only, to be called from `print_platform_details`. */ @@ -643,6 +647,14 @@ void print_bug_report_help() { } else { gb_printf("macOS: Unknown\n"); } + #elif defined(GB_SYSTEM_OPENBSD) + struct utsname un; + + if (uname(&un) != -1) { + gb_printf("%s %s %s %s\n", un.sysname, un.release, un.version, un.machine); + } else { + gb_printf("OpenBSD: Unknown\n"); + } #else gb_printf("Unknown\n"); @@ -657,4 +669,4 @@ void print_bug_report_help() { And RAM info. */ report_ram_info(); -} \ No newline at end of file +} -- cgit v1.2.3 From 00c138ce9f75b7c4911042a32fbc34a7335f2739 Mon Sep 17 00:00:00 2001 From: Sébastien Marie Date: Fri, 25 Feb 2022 09:28:04 +0000 Subject: add RAM information inside report --- src/bug_report.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/bug_report.cpp') diff --git a/src/bug_report.cpp b/src/bug_report.cpp index 7f6b668e8..02a2b1ba2 100644 --- a/src/bug_report.cpp +++ b/src/bug_report.cpp @@ -18,6 +18,7 @@ #endif #if defined(GB_SYSTEM_OPENBSD) + #include #include #endif @@ -246,6 +247,14 @@ void report_ram_info() { if (sysctl(sysctls, 2, &ram_amount, &val_size, NULL, 0) != -1) { gb_printf("%lld MiB\n", ram_amount / gb_megabytes(1)); } + #elif defined(GB_SYSTEM_OPENBSD) + uint64_t ram_amount; + size_t val_size = sizeof(ram_amount); + + int sysctls[] = { CTL_HW, HW_PHYSMEM64 }; + if (sysctl(sysctls, 2, &ram_amount, &val_size, NULL, 0) != -1) { + gb_printf("%lld MiB\n", ram_amount / gb_megabytes(1)); + } #else gb_printf("Unknown.\n"); #endif -- cgit v1.2.3