Subject: Re: Observations on our VM system problem
To: Frank van der Linden <>
From: Greg Hudson <ghudson@MIT.EDU>
List: tech-kern
Date: 03/01/1996 14:36:30
> Seems to me that you need to specify MAP_SHARED in the mmap() calls..

This shouldn't be necessary.  The VM system will assume MAP_PRIVATE if
you don't specify a flag, and the comments say:

		 * Copy-on-write of file.  Two flavors.
		 * MAP_COPY is true COW, you essentially get a snapshot of
		 * the region at the time of mapping.  MAP_PRIVATE means only
		 * that your changes are not reflected back to the object. 
		 * Changes made by others will be seen.

Since I'm never actually touching the mapped regions, doing an msync()
of a private mapping ought to bring the page in sync with the

However, I did try changing my test program to use MAP_SHARED; now it
works if and only if you msync() after the second mmap() call.  So
there's apparently a bug relating to the handling of MAP_PRIVATE
mappings and msync().

Note that lib/libc/db/recno/rec_open() uses a MAP_PRIVATE mapping,
explicitly.  I can still reproduce the vi problem with msync() calls
after that mmap() (and after the mmap() in usr.bin/vi/ex/ex_tag.c).