Re: folder monitoring...
Re: folder monitoring...
- Subject: Re: folder monitoring...
- From: Greg Herlihy <email@hidden>
- Date: Tue, 21 Mar 2006 11:24:00 -0800
- Thread-topic: folder monitoring...
Calling open() on the file with the flags O_RDWR + O_EXLOCK will return an
error if the file has already been opened with an exclusive read-write lock
- which is one way of finding the answer to your question. Note that the
lock is only advisory; it is possible to open the file and write to it
without obtaining exclusive access (although the application frameworks will
not do so). See tech note 2037 "Exclusive File Access in Mac OS X" at
http://developer.apple.com/technotes/tn/tn2037.html for more information.
Greg
On 3/21/06 10:55 AM, "Dominik Wagner" <email@hidden> wrote:
> Hi all!
>
> I've read the two threads on folder monitoring:
> http://www.cocoabuilder.com/archive/message/cocoa/2004/4/20/104800
> and
> http://www.cocoabuilder.com/archive/message/cocoa/2001/7/28/20361
>
> and played around a bit in the lsof code - which sadly is quite
> cryptic - but from my first impressions it looks like lsof really
> reads the kernel data structures, which is something I'd rathe not
> do. Does anybody know of any public api to get all open file
> descriptors for a file and see if anyone has the file open for writing?
>
> best,
> dom
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden