Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

49. Memory Mappings > Anonymous Mappings

Anonymous Mappings

An anonymous mapping is one that doesn’t have a corresponding file. In this section, we show how to create anonymous mappings, and look at the purposes served by private and shared anonymous mappings.

MAP_ANONYMOUS and /dev/zero

On Linux, there are two different, equivalent methods of creating an anonymous mapping with mmap():

  • Specify MAP_ANONYMOUS in flags and specify fd as -1. (On Linux, the value of fd is ignored when MAP_ANONYMOUS is specified. However, some UNIX implementations require fd to be -1 when employing MAP_ANONYMOUS, and portable applications should ensure that they do this.)


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint