• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Create NSStrings from a mapped NSData object - safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create NSStrings from a mapped NSData object - safe?


  • Subject: Re: Create NSStrings from a mapped NSData object - safe?
  • From: Michael Vannorsdel <email@hidden>
  • Date: Tue, 13 May 2008 22:11:51 -0600

Also I should add, I've yet to find a way to protect a file from editing or deletion on OS X that can't just be ignored by something else. Things like flock appear to be optionally supported and not globally enforced. As long as a way exists to get around any kind of file lock there's no way to guarantee a specific file will be unchanged during usage. This is partially done to prevent file lock abuse I'm guessing.

As Mr. Davidson pointed out, the best you can do is only map files you can be reasonably sure no one will want to modify unless purposely trying to corrupt your program.


On May 13, 2008, at 9:57 PM, Michael Vannorsdel wrote:

I actually tested this a month back and not all operations/programs respect link counts nor does the system appear to enforce them. For instance an rm -f will destroy the file regardless of link count, as well as some obscure APIs. After the file was removed the mapping program crashed when trying to read more of the file; it failed to load new map data.


On May 13, 2008, at 9:08 AM, Jens Alfke wrote:

You're correct about modifications, but not about deletions. An open file descriptor counts as a link to a file, so the unlink(2) system call will not actually delete the file from disk because there's still a link to it. Once you close the mapped file, the last link goes away and then the file is actually deleted.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Create NSStrings from a mapped NSData object - safe? (From: Daniel Vollmer <email@hidden>)
 >Re: Create NSStrings from a mapped NSData object - safe? (From: Michael Vannorsdel <email@hidden>)
 >Re: Create NSStrings from a mapped NSData object - safe? (From: Jens Alfke <email@hidden>)
 >Re: Create NSStrings from a mapped NSData object - safe? (From: Michael Vannorsdel <email@hidden>)

  • Prev by Date: Re: Create NSStrings from a mapped NSData object - safe?
  • Next by Date: Weird crash in sendEvent - right click vs control click
  • Previous by thread: Re: Create NSStrings from a mapped NSData object - safe?
  • Next by thread: Re: Create NSStrings from a mapped NSData object - safe?
  • Index(es):
    • Date
    • Thread