[System] Remove arbitrary debugging limit from FileSystemWatcher on OSX, fixes #28693
authorMiguel de Icaza <miguel@gnome.org>
Sat, 5 Dec 2015 20:09:00 +0000 (15:09 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 5 Dec 2015 20:09:06 +0000 (15:09 -0500)
man/mono.1
mcs/class/System/System.IO/KeventWatcher.cs

index a9f8641107ddcaeba4f0319336c40da29195bb07..fb6e7fc2d91fd00747681c6e6eee29bd908e602d 100644 (file)
@@ -999,7 +999,12 @@ where V is the architecture number 4, 5, 6, 7 and the options can be currently b
 .TP
 \fBMONO_ARM_FORCE_SOFT_FLOAT\fR
 When Mono is built with a soft float fallback on ARM and this variable is set to
-"1", Mono will always emit soft float code, even if a VFP unit is detected.
+"1", Mono will always emit soft float code, even if a VFP unit is
+detected.
+.TP
+\fBMONO_DARWIN_WATCHER_MAXFDS\fR
+This is a debugging aid used to force limits on the FileSystemWatcher
+implementation in Darwin.   There is no limit by default.
 .TP
 \fBMONO_DISABLE_AIO\fR
 If set, tells mono NOT to attempt using native asynchronous I/O services. In
index 0d2e39ee02baddcd7c5f4743b3c8087a6af1cdc6..996e0e9b61fafdaf6fa845d870a1e19b7a372ff5 100644 (file)
@@ -162,6 +162,8 @@ namespace System.IO {
 
        class KqueueMonitor : IDisposable
        {
+               static bool initialized;
+               
                public int Connection
                {
                        get { return conn; }
@@ -171,6 +173,13 @@ namespace System.IO {
                {
                        this.fsw = fsw;
                        this.conn = -1;
+                       if (!initialized){
+                               int t;
+                               initialized = true;
+                               var maxenv = Environment.GetEnvironmentVariable ("MONO_DARWIN_WATCHER_MAXFDS");
+                               if (maxenv != null && Int32.TryParse (maxenv, out t))
+                                       maxFds = t;
+                       }
                }
 
                public void Dispose ()
@@ -638,7 +647,7 @@ namespace System.IO {
                const int F_GETPATH = 50;
                const int __DARWIN_MAXPATHLEN = 1024;
                static readonly kevent[] emptyEventList = new System.IO.kevent[0];
-               const int maxFds = 200;
+               int maxFds = Int32.MaxValue;
 
                FileSystemWatcher fsw;
                int conn;