Commit Graph
102 Commits
Author SHA1 Message Date
Alexis Christoforides 717c6de1cc [System.IO] Phase 2 of revamping KeventWatcher (FileSystemWatcher implementation for OS X/kqueue). Dozens of bugs and reliability issues fixed.
FileSystemWatcher.cs: Fixed multicast events.
SearchPattern.cs :  Fixed issue where case insensitivity was not being honored.
KeventWatcher.cs:
* Fixed several race conditions
* Fixed file descriptor duplication & leaks
* thread-safe/cleaner state transitions for watcher, and much cleaner stopping
* Now uses fsw.Filter parameter and respects IncludeSubdirectories = false. Use fsw.Filter to watch very large trees
* Added more error handling + OnError event
* Lots of behavior/reliability fixes and optimizations for Monitor() loop
* Fixed kevent/timespec struct definitions (for 64-bit build)
2014-10-27 21:20:16 -04:00
Cody Russell 13fd028ee8 [System.IO] Reimplemented much of the kqueue-based file watcher so that watching subdirectories works.
Reworked a lot of the internals of the kqueue FileSystemWatcher. There
is now a separate thread and a separate kqueue for each FileSystemWatcher
object.

https://bugzilla.xamarin.com/show_bug.cgi?id=16259
2014-10-27 21:20:16 -04:00
Zoltan Varga 17edd267ab [bcl] Use List instead of ArrayList () in a few places. 2014-10-08 16:12:01 -04:00
Alexis Christoforides d959941265 Revert "Reimplemented much of the kqueue-based file watcher so that watching subdirectories works."
This reverts commit fa9bbe1487.
2014-07-16 17:40:22 -04:00
Alexis Christoforides d0d774479b Revert "Revert some whitespace changes."
This reverts commit dd19aacb90.
2014-07-16 17:40:19 -04:00
Cody Russell dd19aacb90 Revert some whitespace changes. 2014-07-16 17:27:21 -04:00
Cody Russell fa9bbe1487 Reimplemented much of the kqueue-based file watcher so that watching subdirectories works.
https://bugzilla.xamarin.com/show_bug.cgi?id=16259
2014-07-16 17:27:20 -04:00
Miguel de Icaza c60aaa3af6 [System.IO.KeventWatcher] Introduce enums with the KEvent flags and constants
This merely introduces a more readable version of some of the constants that
were hardcoded on the source code.

There is a suspect value "20" that was on the original source code, that
stands for VNodeLink and VNodeExtend, but perhaps the original author
meant to say VNodeRename.   In any case, it seems like we should catch all
of them (except for Revoke).
2014-05-13 18:11:57 -04:00
Andrés G. Aragoneses 0eb40ad2da Fix very sticky typo in numerous places 2014-01-19 17:51:24 +01:00
Marek Safar 7ebf04f546 Remove another duplicate type 2013-02-25 21:53:55 +01:00
Marek Safar 0647a5d16b Remove duplicated files from system.dll (saves about 100kb) 2013-02-25 19:10:09 +01:00
Rob Wilkens 49be3e0ab5 Whitespace fixes 2012-07-01 10:02:07 -04:00
Rob Wilkens 00e7747c14 In KeventWatcher ProcessEvent we were passing null for changedFsi, incorrectly
We had a fsi value for changedFsi, but we were passnig null for it when
calling PostEvent.  This patch corrects that.
2012-07-01 09:40:28 -04:00
Rob Wilkens 119b90edea Second attempt at Bug 5747 change: Deal with possible ending "/" this time.
My first fix for Bug 5747 was reverted because it broke something with
file system monitoring in XSP.

This is a revision of that same patch, but this time i take into account
the possibility that the fsw.FullPath value could possibly end with "/".
The previous version of this commit, no longer in place, didn't factor
that in and as a result if the fullpath ended in "/" we would cut the first
character off filename by virtue of the "Length + 1" substring.

The purpose of this patch was to fix the following problem:
files/directories modified in subdirectories were coming back with
just the file NAME and not subdirectory path.  This patch modifies
the filename so if you get an alert on a file in a subdirectory 'mysubdir/file1'
you would get 'mysubdir/file1' rather than just 'file1', for whatever
direcotry (fullpath) you are watching..

Please note, i tried but i can't get XSP from git to use my local development
version of mono -- as a result i couldn't test against XSP.  Instead, i tested
against the bug report source sample both with and without a trailing '/'
separator.  Prior to this revised version, if full pathname ended in a trailing
'/', and you modified 'file1' you would get back 'ile1' a as the filename if
the prior patch was applied.

Someone may want to test against xsp before accepting this revised submission
2012-06-29 20:35:19 -04:00
Miguel de Icaza b91cbba739 Revert the fix for #5747 from 8b5f71ef60, it broke XSP monitoring of the file system 2012-06-29 15:12:38 -04:00
Miguel de Icaza 0c25179e0b Use Ordinal string comparison here. 2012-06-26 00:57:09 -03:00
Rob Wilkens dc98599ec1 Remove unnecessary braces to save vertical space. 2012-06-20 07:21:24 -04:00
Rob Wilkens 7a847d3db5 Coding Style Changements to make patch more in-line with standards 2012-06-20 07:04:31 -04:00
Rob Wilkens 44addb3224 Bug 5747 Fix: KeventWatcher didn't return subdir names in filenames
Attached extracts the subdirectory by taking a substring of the full
filename path, starting at the length of the watcher filename path
(presuming it matches) plus 1 (to account for the "/" between path and
either subdir or filename).

This only should affect Mac OS -- See this line at top of KeventWatcher.cs:
// System.IO.KeventWatcher.cs: interface with osx kevent
Note the "osx" which is the mac operating system.
2012-06-19 20:45:41 -04:00
Miguel de Icaza f48ceb9860 [System] Removal of the NET_2_0 in the source code
Modulo the GUID in the assembly and the GUID embedded in some
field initializers that use the assembly GUID for their name, the
assemblies are idential before and after the patch.
2012-06-02 13:16:40 -04:00
Marek Safar 482e63b5bd Few corcompare fixes 2011-09-05 19:02:32 +01:00
Raja R Harinath cd51491631 Fix a few cases of mixed line-endings
This is a scripted conversion of mixed line-ending files to LF-only or CRLF-only
based on which patch is smaller.  I used a threshold of upto a quarter of the
lines to determine whether to keep the patch or not.
2010-07-26 02:20:13 +05:30
Raja R Harinath b293948fb7 EOL handling
This set of .gitattributes was automatically generated from the list of files
that GIT tried to normalize when I enabled automatic EOL conversion.

With this set of attributes, we prevent automated EOL conversion on files that
we know will cause trouble down the road.
2010-07-25 20:17:39 +05:30
Gonzalo Paniagua Javier 3a67a60098 2009-11-16 Gonzalo Paniagua Javier <[email protected]>
* DefaultWatcher.cs: patch by James P. Mitchel III.
	The change corrects an instance of unsynchronized access to shared
	state and is probably the intent of the original code.


svn path=/trunk/mcs/; revision=146290
2009-11-16 21:39:30 +00:00
Marek Habersack becbc3884f 2009-09-30 Marek Habersack <[email protected]>
* InotifyWatcher.cs: optimized the Renamed event child update loop
	in the previous commit for directories in ProcessEvents.

svn path=/trunk/mcs/; revision=142984
2009-09-30 10:39:11 +00:00
Gonzalo Paniagua Javier a1cb05c2e4 2009-09-30 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: fixes bug #322330. Patch by Alexander Kojevnikov.
	This patch fixes the issues reported by the OP and in my previous
	comment. In particular:

	Hunks 1 and 4 remove the new_name_needed flag, it's not used
	anywhere and only adds confusion.

	Hunk 2 skips DeleteSelf event for sub-directories, they receive the
	Delete event anyway.

	Hunk 3 makes sure that we use a combination of Deleted+Created
	notifications instead of a single Renamed notification, if the watched item
	has been moved from one directory to another. This is because RenamedEventArgs
	supports only one directory name: FullPath is always directory+name,
	OldFullPath is always directory+old_name.

	Hunk 5 updates relevant InotifyData instances with the new directory
	name.  Without this, notifications always use the original folder names.

	The last hunk may be a bit slow as it needs to iterate on all the
	InotifyData instances. On the other hand, we are already doing it on the
	Delete event (lines 560:568) and by default inotify allows only 8192 watches
	per user.


svn path=/trunk/mcs/; revision=142958
2009-09-30 05:26:16 +00:00
Gonzalo Paniagua Javier 6457cfba7c 2009-07-13 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: when a watched subdirectory is deleted, remove it
	from the list of children and only raise an event if it matches the
	filter.


svn path=/trunk/mcs/; revision=137829
2009-07-13 22:31:34 +00:00
Marek Habersack 90b4f380d1 2009-06-04 Marek Habersack <[email protected]>
* HttpApplicationFactory.cs: OnFileChanged ignores the directory
	part of the file triggering the event. Fixes bug #509998

2009-06-04  Marek Habersack  <[email protected]>

	* InotifyWatcher.cs: filter pattern should be matched on file name
	alone, not on the relative path of the file triggering the
	event. Fixes bug #509998

svn path=/trunk/mcs/; revision=135460
2009-06-04 17:33:52 +00:00
Gonzalo Paniagua Javier 0fff03b008 2009-03-11 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: don't send events when a directory is created
	unless it matches the pattern.  Fixes bug #484082.


svn path=/trunk/mcs/; revision=129112
2009-03-12 00:20:55 +00:00
Marek Habersack 21c73210aa 2009-01-26 Marek Habersack <[email protected]>
* SearchPattern.cs: make IsMatch work for situations when there is
	no wildcard in the pattern, but a subdirectory match is being
	tested, e.g. pattern == "file.txt" and text ==
	"subdir/file.txt". Lack of support for this has been causing
	watching for changes to ASP.NET's web.config in subdirectories to
	fail.

svn path=/trunk/mcs/; revision=124491
2009-01-26 13:26:21 +00:00
Jonathan Chambers 84ec87d71b 2008-11-06 Jonathan Chambers <[email protected]>
* MonoIO.cs : Add DuplicateHandle.

2008-11-06  Jonathan Chambers  <[email protected]>

        * Process.cs : Use DuplicateHandle when redirecting
        StdInput and StdOutput. Fixes bug #436291.



svn path=/trunk/mcs/; revision=118134
2008-11-06 18:48:08 +00:00
Gonzalo Paniagua Javier 000a4db3e3 svn path=/trunk/mcs/; revision=116505 2008-10-20 12:37:55 +00:00
Gonzalo Paniagua Javier f1a6211ad2 2008-10-02 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: IN_CLOSE_WRITE is triggered when a writable file is
	closed, but that does not mean that the file was actually modified.
	Fixes bug #323188.

svn path=/trunk/mcs/; revision=114646
2008-10-02 04:09:54 +00:00
Rodrigo Kumpera d1753383d8 In .:
2008-09-08  Rodrigo Kumpera  <[email protected]>

	* InotifyWatcher.cs: Really fix #359181.


svn path=/trunk/mcs/; revision=112515
2008-09-08 16:01:21 +00:00
Dick Porter 3ea724a977 2008-09-01 Dick Porter <[email protected]>
* InotifyWatcher.cs: Revert fix for bug 322330, as it is somehow
	breaking other stuff.


svn path=/trunk/mcs/; revision=112020
2008-09-01 13:03:29 +00:00
Dick Porter 5b576bcc65 2008-06-20 Dick Porter <[email protected]>
* InotifyWatcher.cs: If a directory is renamed, make sure the old
	version is removed from the requests hash.  Fixes bug 322330.



svn path=/trunk/mcs/; revision=106302
2008-06-20 13:31:37 +00:00
Rodrigo Kumpera 1afd66ee47 2008-06-18 Rodrigo Kumpera <[email protected]>
* InotifyWatcher.cs: patch from Juraj Skripsky to fix
	rename events (fixes bug #359181).



svn path=/trunk/mcs/; revision=106129
2008-06-18 17:22:55 +00:00
Marek Habersack 72103eca65 2008-04-17 Marek Habersack <[email protected]>
* FileSystemWatcher.cs: added support for NullFileWatcher. Fixes
	bug #354701

	* NullFileWatcher.cs: added an IFileWatcher implementation which
	does nothing. Selected only by setting the MONO_MANAGED_WATCHER
	environment variable to 'disabled'. Fixes bug #354701

svn path=/trunk/mcs/; revision=100953
2008-04-16 22:31:33 +00:00
Paolo Molaro 1f89e1d097 Tue Mar 11 14:29:22 CET 2008 Paolo Molaro <[email protected]>
* InotifyWatcher.cs: patch from Anders Rune Jensen ([email protected])
	to reduce memory usage (fixes bug #362147).


svn path=/trunk/mcs/; revision=97948
2008-03-11 12:47:12 +00:00
Sebastien Pouliot 9ca8585525 2007-11-06 Sebastien Pouliot <[email protected]>
* InvalidDataException.cs: Added private ctor for serialization. Fix 
	bug #324569.


svn path=/trunk/mcs/; revision=89018
2007-11-06 18:44:06 +00:00
Miguel de Icaza f26538eb5f Remove unnecessary TODOs, NIEX
svn path=/trunk/mcs/; revision=88689
2007-11-01 21:42:58 +00:00
Robert Jordan 535abaefa2 In Test/System.Diagnostics:
2007-10-30  Robert Jordan  <[email protected]>

	* ProcessTest.cs: Add tests for bug #319829.

In System.Diagnostics:
2007-10-30  Robert Jordan  <[email protected]>

	* Process.cs: Wrap the redirected streams with a stream
	that provides real async Begin/Read|Write operations.
	Fixes bug #319829.

In System.IO:
2007-10-30  Robert Jordan  <[email protected]>

	* MonoSyncFileStream.cs: Add.


svn path=/trunk/mcs/; revision=88491
2007-10-30 18:35:42 +00:00
Juraj Skripsky c616e7e11b 2007-07-19 Juraj Skripsky <[email protected]>
* FileSystemWatcher.ch (RaiseEvent): Invoke delegate directly, we don't
	need the extra control provided by using GetInvocationList().



svn path=/trunk/mcs/; revision=82295
2007-07-19 15:56:49 +00:00
Sebastien Pouliot 71e6b1a839 2006-11-01 Sebastien Pouliot <[email protected]>
* ErrorEventHandler.cs: Remove [Serializable] in NET_2_0.
	* FileSystemEventHandler.cs: Remove [Serializable] in NET_2_0.
	* FileSystemWatcher.cs: Add missing attributes for NET_2_0.
	* InvalidDataException.cs: Seal class and remove serialization ctor.
	* NotifyFilters.cs: Remove [Serializable] in NET_2_0.
	* RenamedEventHandler.cs: Remove [Serializable] in NET_2_0.
	* WatcherChangeTypes.cs: Remove [Serializable] in NET_2_0.


svn path=/trunk/mcs/; revision=67219
2006-11-01 14:20:11 +00:00
Gonzalo Paniagua Javier 2334eaa559 2006-10-04 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: workaround for a weird case. Someone is watching
	/dev with recursion enabled and the inotify file descriptor shows up
	as a directory that fails to open. Already reported to Robert Love.


svn path=/trunk/mcs/; revision=66273
2006-10-04 22:02:15 +00:00
Gonzalo Paniagua Javier be40c48e05 2006-09-05 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: fix file names for the rename event.
	* FileSystemWatcher.cs: ignore exceptions that happen when invoking
	event handlers.


svn path=/trunk/mcs/; revision=64950
2006-09-05 15:38:06 +00:00
Gonzalo Paniagua Javier 249c9d5bcb 2006-08-21 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: handle CloseWrite, as it might happen without other
	modify events.


svn path=/trunk/mcs/; revision=64170
2006-08-21 23:32:38 +00:00
Gonzalo Paniagua Javier a25ada1d51 2006-08-16 Gonzalo Paniagua Javier <[email protected]>
* FileSystemWatcher.cs: avoid argument null when we don't know yet the
	target of a rename.


svn path=/trunk/mcs/; revision=63858
2006-08-16 23:02:44 +00:00
Gonzalo Paniagua Javier 532325d1c2 2006-08-03 Gonzalo Paniagua Javier <[email protected]>
* InotifyWatcher.cs: warn about inotify user watches limit.


svn path=/trunk/mcs/; revision=63309
2006-08-03 16:51:11 +00:00
Sebastien Pouliot f89c00adf4 2005-07-31 Sebastien Pouliot <[email protected]>
* FileSystemWatcher.cs: Add an EnvironmentPermission assert to read
	environment variable MONO_MANAGED_WATCHER.


svn path=/trunk/mcs/; revision=63177
2006-07-31 13:15:09 +00:00