[openbeos] Re: mmap, vm2 and you

  • From: "Alexander G. M. Smith" <agmsmith@xxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 05 Sep 2002 21:40:18 EDT (-0400)

> One can argue if this is good or bad behavior. I am not even sure what the 
> "right" behavior is. I don't see anything in the man pages or elsewhere that 
> says explicitly that mmap uses a snapshot of the file at the time of 
> execution of the mmap OR that mmap is always up to date with the file system. 
> My intuition tells me that up to date is better.

They probably map the disk blocks of the file directly to memory pages.  Or 
even combine the VM and disk block cache, in which case it would always be up 
to date (no need to flush the file to disk, etc).  This assumes that each disk 
block contains pure file data, which won't work on fancier file systems where 
the block can contain metadata mixed in with regular data, or even data from 
several files (like ReiserFS).

> Anyway. What I wanted to ask you all is this - does anyone know of MAP_COPY 
> or MAP_PRIVATE being used in real software? I can write cases for them, but 
> it is more work and I thought that I would ask and see if anyone knows of 
> people actually using them. It somewhat complicates things (and they are 
> slower than their more public compatriots).

Just doing a Google search shows XFree86, Pipermail mention it.  The rest of 
the hits seem to be security flaw reports!  A better test would be to grep 
through a bunch of Linux OS and application source.  Anyone got a Linux box 

- Alex

Other related posts: