Re: folder monitoring...
Re: folder monitoring...
- Subject: Re: folder monitoring...
- From: Dominik Wagner <email@hidden>
- Date: Wed, 22 Mar 2006 12:02:38 +0100
Hi Greg,
thanks - that sounded good - but sadly isn't true for cp - when
copying a large file will let me get me my file descriptor with
O_RDWR + O_EXLOCK of the resulting file - so this isn't an option
either.
I'm still open for valid suggestions. What do the Spotlight guys do?
Import often, or do they have a method of determing when a large file
is completely written?
dom
On 21.03.2006, at 20:24, Greg Herlihy wrote:
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
--
Dominik Wagner Mail: email@hidden
TheCodingMonkeys http://www.codingmonkeys.de/
Blog - DasGenie: !Scrap http://scrap.dasgenie.com/
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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