Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mono/mini/driver.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mono/mini/driver.c b/mono/mini/driver.c
index 884d4a82ae9..0cc353cfca7 100644
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -58,6 +58,9 @@
#include <locale.h>
#include "version.h"
#include "debugger-agent.h"
+#if TARGET_OSX
+# include <sys/resource.h>
+#endif
static FILE *mini_stats_fd;
@@ -1462,6 +1465,26 @@ switch_gc (char* argv[], const char* target_gc)
#endif
}
+#ifdef TARGET_OSX
+
+/*
+ * tries to increase the minimum number of files, if the number is below 1024
+ */
+static void
+darwin_change_default_file_handles ()
+{
+ struct rlimit limit;
+
+ if (getrlimit (RLIMIT_NOFILE, &limit) == 0){
+ if (limit.rlim_cur < 1024){
+ limit.rlim_cur = MAX(1024,limit.rlim_cur);
+ setrlimit (RLIMIT_NOFILE, &limit);
+ }
+ }
+}
+
+#endif
+
/**
* mono_main:
* @argc: number of arguments in the argv array
@@ -1514,6 +1537,10 @@ mono_main (int argc, char* argv[])
setlocale (LC_ALL, "");
+#if TARGET_OSX
+ darwin_change_default_file_handles ();
+#endif
+
if (g_getenv ("MONO_NO_SMP"))
mono_set_use_smp (FALSE);