Use getrlimit(2) to set the maximum number of monitors instead of an

harcoded value.
This commit is contained in:
ajacoutot 2012-01-01 11:21:16 +00:00
parent 95a4fc7621
commit aa6ec00919
2 changed files with 41 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.90 2012/01/01 09:02:11 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.91 2012/01/01 11:21:16 ajacoutot Exp $
# XXX Binary files patch-src_tracker-control_tracker-control-general_c
# and patch-src_tracker-control_tracker-control-general_c.new differ
@ -21,7 +21,7 @@ PKGNAME-main= meta-tracker-${VERSION}
PKGNAME-evolution= evolution-meta-tracker-${VERSION}
PKGNAME-nautilus= nautilus-meta-tracker-${VERSION}
REVISION-main= 1
REVISION-main= 2
MAJ_V= ${GNOME_VERSION:C/^([0-9]+\.[0-9]+).*/\1/}
EVO_VERSION= 3.2

View File

@ -1,23 +1,52 @@
$OpenBSD: patch-src_libtracker-miner_tracker-monitor_c,v 1.3 2012/01/01 09:02:11 ajacoutot Exp $
$OpenBSD: patch-src_libtracker-miner_tracker-monitor_c,v 1.4 2012/01/01 11:21:16 ajacoutot Exp $
Recognize the gio-kqueue monitoring backend.
(not to be pushed upstream before the glib changes are there first)
--- src/libtracker-miner/tracker-monitor.c.orig Fri Dec 30 15:12:53 2011
+++ src/libtracker-miner/tracker-monitor.c Fri Dec 30 15:17:59 2011
@@ -294,6 +294,15 @@ tracker_monitor_init (TrackerMonitor *object)
--- src/libtracker-miner/tracker-monitor.c.orig Fri Dec 16 16:23:55 2011
+++ src/libtracker-miner/tracker-monitor.c Sun Jan 1 12:12:46 2012
@@ -23,6 +23,13 @@
#include <string.h>
#include <gio/gio.h>
+/* getrlimit(2) */
+#if defined (__OpenBSD__)
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
#include "tracker-monitor.h"
#include "tracker-marshal.h"
@@ -222,6 +229,9 @@ tracker_monitor_init (TrackerMonitor *object)
const gchar *name;
GError *error = NULL;
+#if defined (__OpenBSD__)
+ struct rlimit rl;
+#endif
object->priv = TRACKER_MONITOR_GET_PRIVATE (object);
priv = object->priv;
@@ -293,6 +303,20 @@ tracker_monitor_init (TrackerMonitor *object)
* negative maximum.
*/
priv->monitor_limit = MAX (priv->monitor_limit, 0);
}
+ }
+ else if (strcmp (name, "GKqueueDirectoryMonitor") == 0) {
+ /* Using kqueue(2) */
+ g_message ("Monitor backend is kqueue(2)");
+
+ /*
+ * XXX use getrlimit(2) (or its glib equivalent)
+ */
+#if defined (__OpenBSD__)
+ if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
+ priv->monitor_limit = (rl.rlim_cur*90)/100;
+ } else {
+ priv->monitor_limit = 128;
+ }
+#else
+ priv->monitor_limit = 400;
+ }
+#endif
}
else if (strcmp (name, "GFamDirectoryMonitor") == 0) {
/* Using Fam */
g_message ("Monitor backend is Fam");