[Mono-osx] An open letter to the OS X Mono group.
Andreas Färber
andreas.faerber at web.de
Sat Apr 7 07:49:07 EDT 2007
Am 07.04.2007 um 07:30 schrieb Louis R. Marascio:
> Andreas Frber <andreas.faerber at web.de> wrote:
>> Is System.IO.FileSystemWatcher not a supported feature then? As
>> reported, it is not working fine:
>> http://bugzilla.ximian.com/show_bug.cgi?id=80564
>> Yet no-one is showing any interest in helping me fix this for Mac OS
>> X... I needed to move part of my application to a Solaris server
>> instead.
>
> For some reason I've been spending my Friday night poking at this bug
> trying to determine some type of pattern.
>
> It appears that Created and Deleted events are generated properly but
> Changed events are not. For example, using your test case I get no
> Changed events. I wrote a stand alone program to monitor the current
> directory and if I run that program and then cat or echo into a file,
> no Changed event fires; however, if I use vi to edit a file and then
> save it I do get a Changed event. Go figure...
>
> I'll attach my additional test program and notes to the bug.
Thanks.
My findings seemed to indicate that the root of these problems was
deeper than the firing of the managed events: Using test code I
shared with Geoff a change to a file (length, contents, last write)
did not trigger a kevent event on the directory's file descriptor. I
would be fine with a solution like in my test implementation where I
determine whether a directory or a single file should be monitored
and then use the respective file descriptor for kevent.
The remaining problem then is: How do we handle wildcards? Currently
we have a 1:1 mapping of FileSystemWatchers to file descriptors. But
what if a user wants to monitor a directory with hundreds of files?
The commented out part of my test implementation shows that we are
limited to 255 open file descriptors in whole. According to my
reading this is what Linux software like inotify and the like handle
- but nothing comparable seems to be available for OS X except some
hacky ways of accessing the undocumented internals of Tiger's
Spotlight engine. And Finder's FSNotify seems to be an even worse way
of detecting changes. So kevent seems to be our best bet for now -
it's just the question of how to use it.
I remember reading a reference to XSP in the ChangeLog so this is
likely to affect Mono's ASP.NET implementation, not just some
minor .NET based applications.
Andreas
More information about the Mono-osx
mailing list