41 lines
980 B
Text
41 lines
980 B
Text
|
$NetBSD: patch-ay,v 1.1 2009/10/11 10:49:56 tnn Exp $
|
||
|
|
||
|
--- browser/app/nsBrowserApp.cpp.orig 2009-06-29 18:14:40.000000000 +0200
|
||
|
+++ browser/app/nsBrowserApp.cpp
|
||
|
@@ -44,6 +44,27 @@
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdarg.h>
|
||
|
+#include <sys/resource.h>
|
||
|
+/*
|
||
|
+ * On netbsd-4, ulimit -n is 64 by default; too few for us.
|
||
|
+ */
|
||
|
+static void netbsd_fixrlimit(void) {
|
||
|
+ struct rlimit rlp;
|
||
|
+ if (getrlimit(RLIMIT_NOFILE, &rlp) == -1) {
|
||
|
+ fprintf(stderr, "warning: getrlimit failed\n");
|
||
|
+ return;
|
||
|
+ }
|
||
|
+ if (rlp.rlim_cur >= 512)
|
||
|
+ return;
|
||
|
+ if (rlp.rlim_max < 512) {
|
||
|
+ fprintf(stderr, "warning: hard limit of 'ulimit -n' too low\n");
|
||
|
+ rlp.rlim_cur = rlp.rlim_max;
|
||
|
+ }
|
||
|
+ else
|
||
|
+ rlp.rlim_cur = 512;
|
||
|
+ if (setrlimit(RLIMIT_NOFILE, &rlp) == -1)
|
||
|
+ fprintf(stderr, "warning: setrlimit failed\n");
|
||
|
+}
|
||
|
|
||
|
#include "plstr.h"
|
||
|
#include "prprf.h"
|
||
|
@@ -106,6 +127,7 @@ public:
|
||
|
|
||
|
int main(int argc, char* argv[])
|
||
|
{
|
||
|
+ netbsd_fixrlimit();
|
||
|
ScopedLogging log;
|
||
|
|
||
|
nsCOMPtr<nsILocalFile> appini;
|