Re: mmap call to filesystem
Re: mmap call to filesystem
- Subject: Re: mmap call to filesystem
- From: "shailesh jain" <email@hidden>
- Date: Sat, 28 Jun 2008 19:33:39 -0700
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.
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.
= Mike
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 ?
/Shail
_______________________________________________
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