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: kqueue on OS X



On Feb 18, 2004, at 9:21 AM, Glen Low wrote:

>>> Another thing you might want to look at re: your sample code is the
>>> usual OS X document save scheme (Cocoa for example, but I suppose the
>>> FSSpec file swap works the same way), which goes like:
>>>
>>> 1. Rename old file.
>>> 2. Save new file at old file's name.
>>> 3. Delete old file.
>>>
>>> This means when I run a kqueue with EVFILT_VNODE, strangely enough I
>>> don't see the first rename, but I see the delete, at which stage the
>>> vnode I'm monitoring is defunct and I have to reopen the vnode to
>>> monitor again.
>>
>> Not strange at all, since renaming a file doesn't modify that file at
>> all (just [one of] the parent directories that refer to it). If you
>> were monitoring the parent directory, you would have seen the event
>> for
>> that rename.
>
> I only need the assurance that when the old file is deleted, when I
> attempt to reopen it the new file should be there. (I can't see how a
> Cocoa or HFS safe-save would work, if the saving of the new file
> happens after the deleting of the old file.)

Because it is really closer to:
copy (or hard-link) old file.
save new file at some new (hidden) name
link to new file under old name (atomically replaces what that name
refers to)
remove old file and new (hidden) name links

on filesystems that support such operations. So, as soon as the old
file looses its last reference, there is already new file under that
name.

--Jim

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: kqueue on OS X (From: Glen Low <email@hidden>)
 >Re: kqueue on OS X (From: Jim Magee <email@hidden>)
 >Re: kqueue on OS X (From: Glen Low <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.