msync patch

Corinna Vinschen cygwin-patches@cygwin.com
Mon Mar 11 12:38:00 GMT 2002


On Mon, Mar 11, 2002 at 06:07:03PM -0000, Chris January wrote:
> This patch modifies msync in mmap.cc so that you can call msync with an
> address which occurs in the middle of an mmap'ed region. It also fixes the
> bug where the address in the relevant mmap_record would not match the one
> passed to msync if the offset of the mmap'ed region within the file was not
> on a dwAllocationGranularity boundary.

First I was inclined to refuse the patch since SUSv2 requires
`addr' to be a multiple of getpagesize() but POSIX doesn't
so it's better trying to be POSIX compliant here.

However, the patch only checks the beginning and the end of the
given address range but the address range could span over a
non-mapped region which is a fault from msync's point of view.

I've checked in a slightly different version which uses a method
I implemented today.  msync() now tests if the whole address range
is contigeously mmap'd, returning ENOMEM otherwise.

I'd appreciate if you could give it a try.

Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-patches mailing list