sync ports with The Matrix

This commit is contained in:
purplerain 2023-09-17 04:05:06 +00:00
parent 02776f1507
commit a0fe1892c0
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
885 changed files with 6817 additions and 4874 deletions

View file

@ -0,0 +1,23 @@
Index: src/as-system-info.c
--- src/as-system-info.c.orig
+++ src/as-system-info.c
@@ -45,7 +45,7 @@
#if defined(__linux__)
#include <sys/sysinfo.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
@@ -408,6 +408,10 @@ as_get_physical_memory_total (void)
#elif defined(__FreeBSD__)
unsigned long physmem;
sysctl ((int[]){ CTL_HW, HW_PHYSMEM }, 2, &physmem, &(size_t){ sizeof (physmem) }, NULL, 0);
+ return physmem / MB_IN_BYTES;
+#elif defined(__OpenBSD__)
+ unsigned long physmem;
+ sysctl ((int[]){ CTL_HW, HW_PHYSMEM64 }, 2, &physmem, &(size_t){ sizeof (physmem) }, NULL, 0);
return physmem / MB_IN_BYTES;
#else
#error "Implementation of as_get_physical_memory_total() missing for this OS."