P. 1
Linux Memory

Linux Memory

|Views: 2,280|Likes:
Published by Nitin Gupta

More info:

Published by: Nitin Gupta on Jan 17, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

07/21/2012

pdf

text

original

Prototype:

unsigned long do_mmap()

This function is used to create a new memory region for a process. Its parameters are:

file File descriptor of the file being mapped.

addr Preferred address where this mapping should start from.

len Size of the mapping.

prot Protection flags of the pages in this region

PROT_READ

Pages can be read.

PROT_WRITE

Pages can be written.

PROT_EXEC

Pages can be executed.

PROT_NONE

Pages can not be accessed.

flag Used to specify the type of the mapping. The various flags are

MAP_FIXED

Do not select a different address than the one specified. If

the specified address cannot be used, mmap will fail. If

MAP FIXED is specified, start must be a multiple of the

pagesize.

MAP_SHARED Share this mapping with all other processes that map this

object. Storing to the region is equivalent to writing to the

file.

33

MAP_PRIVATE Create a private copy-on-write mapping. Stores to the

region donot affect the original file.

MAP_DENYWRITE This region maps a file read-only.

MAP_NORESERVE If set, we don¶t check if there is enough memory for the

allocation

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->