Implement low_memory_profile for FreeBSD
Fixes: https://bugs.launchpad.net/midori/+bug/963833
This commit is contained in:
parent
76be3b9aea
commit
7789bafc68
1 changed files with 12 additions and 0 deletions
|
@ -26,6 +26,10 @@
|
||||||
#if defined (G_OS_UNIX)
|
#if defined (G_OS_UNIX)
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct _MidoriWebSettings
|
struct _MidoriWebSettings
|
||||||
{
|
{
|
||||||
|
@ -353,6 +357,14 @@ midori_web_settings_low_memory_profile ()
|
||||||
mem.dwLength = sizeof (mem);
|
mem.dwLength = sizeof (mem);
|
||||||
if (GlobalMemoryStatusEx (&mem))
|
if (GlobalMemoryStatusEx (&mem))
|
||||||
return mem.ullTotalPhys / 1024 / 1024 < 352;
|
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
|
#else
|
||||||
gchar* contents;
|
gchar* contents;
|
||||||
const gchar* total;
|
const gchar* total;
|
||||||
|
|
Loading…
Reference in a new issue