diff options
Diffstat (limited to 'www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp')
-rw-r--r-- | www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp b/www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp index 8c6b00de1d48..fd490fc826d1 100644 --- a/www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp +++ b/www/webkit2-gtk4/files/patch-Source_WTF_wtf_RAMSize.cpp @@ -1,15 +1,15 @@ ---- Source/WTF/wtf/RAMSize.cpp.orig 2021-09-22 23:29:42 UTC -+++ Source/WTF/wtf/RAMSize.cpp -@@ -35,6 +35,8 @@ +--- Source/WTF/wtf/RAMSize.cpp.orig 2023-01-31 18:03:55.638729000 -0800 ++++ Source/WTF/wtf/RAMSize.cpp 2023-01-31 18:04:10.292282000 -0800 +@@ -31,7 +31,7 @@ + #if OS(WINDOWS) + #include <windows.h> + #elif USE(SYSTEM_MALLOC) +-#if OS(LINUX) || OS(FREEBSD) ++#if OS(LINUX) #include <sys/sysinfo.h> #elif OS(UNIX) #include <unistd.h> -+#include <sys/types.h> -+#include <sys/sysctl.h> - #endif // OS(LINUX) || OS(UNIX) - #else - #include <bmalloc/bmalloc.h> -@@ -56,14 +58,18 @@ static size_t computeRAMSize() +@@ -56,7 +56,7 @@ return ramSizeGuess; return status.ullTotalPhys; #elif USE(SYSTEM_MALLOC) @@ -18,17 +18,3 @@ struct sysinfo si; sysinfo(&si); return si.totalram * si.mem_unit; - #elif OS(UNIX) -- long pages = sysconf(_SC_PHYS_PAGES); -- long pageSize = sysconf(_SC_PAGE_SIZE); -- return pages * pageSize; -+ size_t physmem, len; -+ int mib[2] = { CTL_HW, HW_PHYSMEM }; -+ if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 -+ && len == sizeof(physmem)) -+ return physmem; -+ else -+ return 512 * MB; // guess - #else - #error "Missing a platform specific way of determining the available RAM" - #endif // OS(LINUX) || OS(FREEBSD) || OS(UNIX) |