mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-27 05:10:36 +00:00
Implement the low memory profile when RAM is lower than 352 MB.
PR: ports/166422 Submitted by: Olivier Duchateau Feature safe: yes
This commit is contained in:
parent
b53124fb35
commit
d69a2379f2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=293867
@ -8,6 +8,7 @@
|
||||
|
||||
PORTNAME= midori
|
||||
PORTVERSION= 0.4.4
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= www xfce
|
||||
MASTER_SITES= ${MASTER_SITE_XFCE}
|
||||
MASTER_SITE_SUBDIR= src/apps/${PORTNAME}/${PORTVERSION:R}
|
||||
|
50
www/midori/files/patch-midori_midori-websettings.c
Normal file
50
www/midori/files/patch-midori_midori-websettings.c
Normal file
@ -0,0 +1,50 @@
|
||||
--- midori/midori-websettings.c.orig 2012-03-08 23:34:45.000000000 +0100
|
||||
+++ midori/midori-websettings.c 2012-03-23 15:48:54.000000000 +0100
|
||||
@@ -27,6 +27,11 @@
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD__)
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#endif
|
||||
+
|
||||
struct _MidoriWebSettings
|
||||
{
|
||||
WebKitWebSettings parent_instance;
|
||||
@@ -347,16 +352,26 @@
|
||||
static gboolean
|
||||
midori_web_settings_low_memory_profile ()
|
||||
{
|
||||
- gchar* contents;
|
||||
- const gchar* total;
|
||||
- if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL))
|
||||
- return FALSE;
|
||||
- if (contents && (total = strstr (contents, "MemTotal:")) && *total)
|
||||
- {
|
||||
- const gchar* value = katze_skip_whitespace (total + 9);
|
||||
- gdouble mem_total = g_ascii_strtoll (value, NULL, 0);
|
||||
- return mem_total / 1024.0 < 352 + 1;
|
||||
- }
|
||||
+ #ifdef __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;
|
||||
+ if (!g_file_get_contents ("/proc/meminfo", &contents, NULL, NULL))
|
||||
+ return FALSE;
|
||||
+ if (contents && (total = strstr (contents, "MemTotal:")) && *total)
|
||||
+ {
|
||||
+ const gchar* value = katze_skip_whitespace (total + 9);
|
||||
+ gdouble mem_total = g_ascii_strtoll (value, NULL, 0);
|
||||
+ return mem_total / 1024.0 < 352 + 1;
|
||||
+ }
|
||||
+ #endif
|
||||
return FALSE;
|
||||
}
|
Loading…
Reference in New Issue
Block a user