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:
authorMiguel de Icaza <miguel@gnome.org>2015-12-09 05:10:13 +0300
committerAlexis Christoforides <alexis@thenull.net>2015-12-14 23:14:26 +0300
commit7b877872dd592e4a53e782ee67a22332444fddb3 (patch)
treed4bed189bd16758bd64a9cdb7bb3054b8de7de7e
parent7ad84f7adc5b9d33d4d0a813dde4e032ad7215a9 (diff)
[mono/driver] On OSX, increase the number of file handles available.mono-4.2.2.10
We just reverted a patch that prevented the FileSystemWatcher from opening too many file descriptors (200). That was a band-aid at one of the spots that opened too many file, as we would exhaust the number of files, and later abort when some other operation needed files. The problem is that OSX defaults to 256 file descriptors, and .NET applications are file descriptor hungry, in fact, many applications increase their file handled limit before starting. This patch on OSX will attempt to increase the number of handles available to 1024 if the number of handles avaialble is less than that. The commit that removed the limit was: 2af882232ce4961fdbe1ba0ae36246456bb1fbfb And it was closed to fix: Conflicts: mono/mini/driver.c
-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);