mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-24 04:03:34 -04:00
41 lines
1.0 KiB
Plaintext
41 lines
1.0 KiB
Plaintext
$NetBSD: patch-av,v 1.1.1.1 2012/03/15 08:58:28 ryoon Exp $
|
|
|
|
--- xulrunner/app/nsXULRunnerApp.cpp.orig 2012-03-09 22:20:39.000000000 +0000
|
|
+++ xulrunner/app/nsXULRunnerApp.cpp
|
|
@@ -37,6 +37,27 @@
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.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");
|
|
+}
|
|
#ifdef XP_WIN
|
|
#include <windows.h>
|
|
#endif
|
|
@@ -274,6 +295,7 @@ private:
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
+ netbsd_fixrlimit();
|
|
if (argc > 1 && (IsArg(argv[1], "h") ||
|
|
IsArg(argv[1], "help") ||
|
|
IsArg(argv[1], "?")))
|