Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Oct 1995 14:18:02 -0700
From:      John Polstra <jdp@polstra.com>
To:        freebsd-hackers@freebsd.org
Subject:   What does MAP_COPY do?
Message-ID:  <199510272118.OAA07337@freebie.polstra.com>

next in thread | raw e-mail | index | archive | help
Could somebody please explain to me what mmap(2) does when the flag MAP_COPY 
is passed to it?  The only documentation I can find is a comment in 
/usr/include/sys/mman.h:

    #define MAP_COPY        0x0004  /* "copy" region at mmap time */

It sounds like this means that a private copy is immediately made of the 
region.  I.e., if two processes map the same file, each with MAP_COPY, they 
will get completely separate copies of the data.  Is that right?

Is the actual data copied, or just the page table entries?

The only reason I can think of that this behavior would be desired would be as 
a work-around for a non-working copy-on-write implementation.  Is that what 
it's for?

Thanks -- enquiring minds gotta know.
-- 
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510272118.OAA07337>