Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limit on kevent entries?



On 12/10/06 5:57, Ian Lister <email@hidden> wrote:

> On Thu, 12 Oct 2006, maurits wrote:
>> is there a limit on the number of files one can simultaneously monitor with
>> the kevent mechanism?
> 
> There are several limits on the number of files you can have open, which
> they have to be to be able to watch them with EVFILT_VNODE.
> 
> $ ulimit -n
> 256
> $ sysctl kern.maxfiles
> kern.maxfiles = 12288
> $ sysctl kern.maxfilesperproc
> kern.maxfilesperproc = 10240
> [etc]
> 
>>                       Basically, I want to monitor if a file has changed, for
>> potentially hundreds or even thousands of files. The code I have (based on
>> Michael McCracken's stakeout) seems to be able to monitor no more than 251
>> files (weird number, I don't have a clue why).
> 
> Because the default resource limit is 256 open files, and you have a few
> things such as stdin/out/err and the kqueue open, as well as all the files
> you're trying to monitor.
> 
> You can increase the resource limit to kern.maxfilesperproc, which might
> be "good enough" for your purposes.
> 
>>                                                Is there a limitation? Is it
>> even sensible to monitor so many files simultaneously using the kevent
>> mechanism?
> 
> I don't think so, mostly because it's not sensible to have so many files
> open in order to be able to monitor them. I think there are non-portable
> ways to do this at higher levels (e.g. the way Spotlight and Time Machine
> watch huge chunks of the filesystem), but I don't know them. Try some
> filesystem doc, or wait for somebody more knowledgeable to provide a
> better answer :-)

Amit Singh's got a sample app which uses the same mechanism that Spotlight
uses for spotting filesystem events, i.e. reading from /dev/fsevents. This
is not officially documented of course, but you can look at its
implementation in the Darwin sources.

<http://www.kernelthread.com/software/fslogger/>

Cheers,

Chris


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Limit on kevent entries? (From: Ian Lister <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.