]> spindle.queued.net Git - midori/commitdiff
Implement low_memory_profile for FreeBSD
authorOlivier Duchateau <duchateau.olivier@gmail.com>
Sun, 25 Mar 2012 15:53:45 +0000 (17:53 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 25 Mar 2012 16:10:26 +0000 (18:10 +0200)
Fixes: https://bugs.launchpad.net/midori/+bug/963833
midori/midori-websettings.c

index 0bd4e81bf79a1e08f4f5dc1bbc59b41015ee6e74..7b13a8795c946b957f55aec89aabc4046fffaf2f 100644 (file)
 #if defined (G_OS_UNIX)
     #include <sys/utsname.h>
 #endif
+#if defined(__FreeBSD__)
+    #include <sys/types.h>
+    #include <sys/sysctl.h>
+#endif
 
 struct _MidoriWebSettings
 {
@@ -353,6 +357,14 @@ midori_web_settings_low_memory_profile ()
     mem.dwLength = sizeof (mem);
     if (GlobalMemoryStatusEx (&mem))
         return mem.ullTotalPhys / 1024 / 1024 < 352;
+#elif defined(__FreeBSD__)
+    size_t size;
+    int mem_total;
+    size = sizeof mem_total;
+
+    sysctlbyname("hw.realmem", &mem_total, &size, NULL, 0);
+
+    return mem_total / 1048576 < 352;
 #else
     gchar* contents;
     const gchar* total;