[Mono-osx] An open letter to the OS X Mono group.

Louis R. Marascio louis at fitnr.com
Sat Apr 7 13:13:30 EDT 2007


Louis R. Marascio <louis at fitnr.com> wrote:
>Andreas Frber <andreas.faerber at web.de> wrote:
>>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.
>
> ... deleted ...
>
>As it stands now it doesn't work, so even if we make it work up to 255
>monitored files that's an improvement. Ideally, Apple would make the
>EVFILT_FS kevent filter available as a public API as this is clearly
>Apple's scalable FS monitoring method.

Gurgle... sending emails too early in the morning. Even if EVFILT_FS
were opened it requires super user priviledges, so it really is a
non-starter in it's current form. Regardless, kevent should work fine
with some tweaking.

The limit can of course be increased as users require to more reasonable
numbers using ulimit, etc. I would suggest something along these lines:

  * If a FSW is asked to monitor for Created and Deleted events, then
    there is no need to monitor individual files within a directory.

  * If a FSW is asked to monitor a specific file or a directory with a
    wildcard then we will need to open each file that matches the filter
    and watch it.

  * If someone is unhappy with the 255 open file descriptor limit, they
    will need to modify their ulimits accordingly. It appears that 10.4
    has a hard limit of 512 by default. This can be modified relatively
    easily to some arbitrarily high value given some OS X config file
    hacking.

I think this would work, am I missing anything?

Louis

-- 
Louis R. Marascio - www.fitnr.com
... fixed in the next release ...



More information about the Mono-osx mailing list