\hypertarget{group__Escape__Mman}{}\section{Functions that manage memory mappping.}
\label{group__Escape__Mman}\index{Functions that manage memory mappping.@{Functions that manage memory mappping.}}


This header provides the meomry map functions mmap and munmap.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void $\ast$ \hyperlink{group__Escape__Mman_ga1a69b9ee2b96ed0934c9f9c433f348ce}{mmap} (void $\ast$addr, size\+\_\+t len, int prot, int flags, int fd, off\+\_\+t offset)
\begin{DoxyCompactList}\small\item\em Creates or opens a named or unnamed file mapping object for a specified file and maps a view of a file mapping into the address space of a calling process. \end{DoxyCompactList}\item 
int \hyperlink{group__Escape__Mman_ga01ff21bc70401bee9b80c350763087f7}{munmap} (void $\ast$addr, size\+\_\+t len)
\begin{DoxyCompactList}\small\item\em Unmaps a mapped view of a file from the calling process\textquotesingle{}s address space. \end{DoxyCompactList}\item 
int \hyperlink{group__Escape__Mman_gac1842269384644cb3cf52919b6a0c014}{madvise} (void $\ast$addr, size\+\_\+t length, int advice)
\begin{DoxyCompactList}\small\item\em give advice about use of memory \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This header provides the meomry map functions mmap and munmap. 



\subsection{Function Documentation}
\index{Functions that manage memory mappping.@{Functions that manage memory mappping.}!mmap@{mmap}}
\index{mmap@{mmap}!Functions that manage memory mappping.@{Functions that manage memory mappping.}}
\subsubsection[{\texorpdfstring{mmap(void $\ast$addr, size\+\_\+t len, int prot, int flags, int fd, off\+\_\+t offset)}{mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)}}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ mmap (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{addr, }
\item[{size\+\_\+t}]{len, }
\item[{int}]{prot, }
\item[{int}]{flags, }
\item[{int}]{fd, }
\item[{off\+\_\+t}]{offset}
\end{DoxyParamCaption}
)}\hypertarget{group__Escape__Mman_ga1a69b9ee2b96ed0934c9f9c433f348ce}{}\label{group__Escape__Mman_ga1a69b9ee2b96ed0934c9f9c433f348ce}


Creates or opens a named or unnamed file mapping object for a specified file and maps a view of a file mapping into the address space of a calling process. 


\begin{DoxyParams}{Parameters}
{\em addr} & Unused \\
\hline
{\em len} & Number of bytes to be mapped. \\
\hline
{\em prot} & Protections. \\
\hline
{\em flags} & Type of the mapped object. \\
\hline
{\em fd} & File descriptor that describes the object to map. \\
\hline
{\em offset} & Number of bytes from which to start the mapping. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The starting address of the mapped view on success, -\/1 otherwise.
\end{DoxyReturn}
Create or open an unnamed file mapping object for a specified file described by the file descriptor {\ttfamily fd}. The number of bytes that are mapped is given by {\ttfamily len} and start after {\ttfamily offset} bytes. The parameter {\ttfamily addr} is unused.

The only type of the mapped object that is supported is {\ttfamily M\+A\+P\+\_\+\+S\+H\+A\+R\+ED}. If another value if given, -\/1 is returned.

{\ttfamily prot} specifies the protection of the mapped region. If P\+R\+O\+T\+\_\+\+E\+X\+EC is used, it set the execute access. If P\+R\+O\+T\+\_\+\+R\+E\+AD is used, it sets the read access. If P\+R\+O\+T\+\_\+\+W\+R\+I\+TE is used, it sets the write access.

If the map view of file can not be created, -\/1 is returned. If the mappping can not be done, -\/1 is returned.

If no error occurred, the starting address of the mapped view is returned.

Conformity\+: None. \index{Functions that manage memory mappping.@{Functions that manage memory mappping.}!munmap@{munmap}}
\index{munmap@{munmap}!Functions that manage memory mappping.@{Functions that manage memory mappping.}}
\subsubsection[{\texorpdfstring{munmap(void $\ast$addr, size\+\_\+t len)}{munmap(void *addr, size_t len)}}]{\setlength{\rightskip}{0pt plus 5cm}int munmap (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{addr, }
\item[{size\+\_\+t}]{len}
\end{DoxyParamCaption}
)}\hypertarget{group__Escape__Mman_ga01ff21bc70401bee9b80c350763087f7}{}\label{group__Escape__Mman_ga01ff21bc70401bee9b80c350763087f7}


Unmaps a mapped view of a file from the calling process\textquotesingle{}s address space. 


\begin{DoxyParams}{Parameters}
{\em addr} & Pointer to the base address. \\
\hline
{\em len} & Unused. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 otherwise.
\end{DoxyReturn}
Unmaps a mapped view of a file from the calling process\textquotesingle{}s address space. {\ttfamily addr} is the pointer to the base address. This value must be identical to the value returned by a previous call to \hyperlink{group__Escape__Mman_ga1a69b9ee2b96ed0934c9f9c433f348ce}{mmap()}. The parameter {\ttfamily len} is unsed.

Conformity\+: None. \index{Functions that manage memory mappping.@{Functions that manage memory mappping.}!madvise@{madvise}}
\index{madvise@{madvise}!Functions that manage memory mappping.@{Functions that manage memory mappping.}}
\subsubsection[{\texorpdfstring{madvise(void $\ast$addr, size\+\_\+t length, int advice)}{madvise(void *addr, size_t length, int advice)}}]{\setlength{\rightskip}{0pt plus 5cm}int madvise (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{addr, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{advice}
\end{DoxyParamCaption}
)}\hypertarget{group__Escape__Mman_gac1842269384644cb3cf52919b6a0c014}{}\label{group__Escape__Mman_gac1842269384644cb3cf52919b6a0c014}


give advice about use of memory 


\begin{DoxyParams}{Parameters}
{\em addr} & Unused. \\
\hline
{\em length} & Unused. \\
\hline
{\em advice} & Unused. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 otherwise.
\end{DoxyReturn}
The \hyperlink{group__Escape__Mman_gac1842269384644cb3cf52919b6a0c014}{madvise()} system call advises the kernel about how to handle paging input/output in the address range beginning at address addr and with size length bytes. It allows an application to tell the kernel how it expects to use some mapped or shared memory areas, so that the kernel can choose appropriate read-\/ahead and caching techniques. This call does not influence the semantics of the application (except in the case of M\+A\+D\+V\+\_\+\+D\+O\+N\+T\+N\+E\+ED), but may influence its performance. The kernel is free to ignore the advice.

Conformity\+: None. 