blob: a69e47ad9eb25c0ed33ae247ee3095c1f1928bfb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
$NetBSD: patch-ay,v 1.1 2013/11/13 13:27:45 ryoon Exp $
--- mozilla/browser/app/nsBrowserApp.cpp.orig 2012-08-25 00:30:56.000000000 +0000
+++ mozilla/browser/app/nsBrowserApp.cpp
@@ -14,6 +14,31 @@
#include <sys/resource.h>
#endif
+#include <sys/resource.h>
+
+#ifdef __NetBSD__
+/*
+ * 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");
+}
+#endif
+
#ifdef XP_MACOSX
#include "MacQuirks.h"
#endif
@@ -196,6 +221,9 @@ int main(int argc, char* argv[])
#ifdef XP_MACOSX
TriggerQuirks();
#endif
+#ifdef __NetBSD__
+ netbsd_fixrlimit();
+#endif
nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
if (NS_FAILED(rv)) {
|