• 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: mmap call to filesystem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mmap call to filesystem


  • Subject: Re: mmap call to filesystem
  • From: Michael Smith <email@hidden>
  • Date: Sat, 28 Jun 2008 23:25:00 -0700


On Jun 28, 2008, at 7:33 PM, shailesh jain wrote:
On Sat, Jun 28, 2008 at 7:09 PM, Michael Smith <email@hidden> wrote:

On Jun 28, 2008, at 5:09 PM, shailesh jain wrote:

2) Also, I wanted to know about the option MAP_PRIVATE passed to the mmap call. When, this option
is passed, the modifications to the data are just made in-memory and are not reflected to the actual object. Now, If PROT_WRITE option is passed to the filesystem and the file is just opened for reading,
should the call fail ?

No.  It is perfectly legal to open a file with read/write permission and then map a portion such that changes to the mapped region are not written back to the file.

For mmap to succeed, the file should have been opened with the read flag always.

Not at all.   A file can be written to without being read, whether the vector by which it is written is a mapped operation or a regular file write.

Shouldn't it depend upon options {MAP_PRIVATE or MAP_SHARED } which are not passed to the filesystem ?

No.  The VM is responsible for deciding whether pages will be written to the file; the filesystem is generally not involved in authorisation.


Also, I was looking at the mmap implementation but couldn't figure out how MAP_PRIVATE option was handled by kernel.

You're looking at the wrong place; you want to look at how the VM sets up the mapping against the object.  You can expect to see the region marked copy-on-write, with an intermediate copy object involved.

So, if the filesystem is not involved in authorization that what is the purpose of passing  protection flag {PROT_WRITE, PROT_READ, PROT_EXEC} to the filesystem ?

These are supplied as a courtesy to the filesystem in case it wants/needs to make specific arrangements regarding the mapping. 

Unless the filesystem is a proxy for a remote authority (e.g. a network filesystem), its responsibility regarding authorisation is limited to correctly answering questions posed by VNOP_GETATTR.

 = Mike

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: mmap call to filesystem
      • From: "shailesh jain" <email@hidden>
References: 
 >mmap call to filesystem (From: "shailesh jain" <email@hidden>)
 >Re: mmap call to filesystem (From: "shailesh jain" <email@hidden>)

  • Prev by Date: Re: mmap call to filesystem
  • Next by Date: Re: mmap call to filesystem
  • Previous by thread: Re: mmap call to filesystem
  • Next by thread: Re: mmap call to filesystem
  • Index(es):
    • Date
    • Thread