\hypertarget{group__Eina__Mmap__Group}{}\section{Mmap Group}
\label{group__Eina__Mmap__Group}\index{Mmap Group@{Mmap Group}}


These functions provide helpers for safe mmap handling.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Mmap__Group_ga3452104185eaee1f8d9acab09561e037}{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set} (\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} enabled)
\begin{DoxyCompactList}\small\item\em Enable or disable safe mmaped IO handling. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Eina__Mmap__Group_ga1aee5310614057b6dc62a67564ec6a2a}{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get} (void)
\begin{DoxyCompactList}\small\item\em Get the enabled state of mmap safety. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
These functions provide helpers for safe mmap handling. 

\begin{DoxySince}{Since}
1.\+1.\+0 
\end{DoxySince}


\subsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Mmap__Group_ga3452104185eaee1f8d9acab09561e037}\label{group__Eina__Mmap__Group_ga3452104185eaee1f8d9acab09561e037}} 
\index{Mmap Group@{Mmap Group}!eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set@{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set}}
\index{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set@{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set}!Mmap Group@{Mmap Group}}
\subsubsection{\texorpdfstring{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set()}{eina\_mmap\_safety\_enabled\_set()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set (\begin{DoxyParamCaption}\item[{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}}]{enabled }\end{DoxyParamCaption})}



Enable or disable safe mmaped IO handling. 


\begin{DoxyParams}{Parameters}
{\em enabled} & The enabled state (to enable, pass \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE}) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE} on success, \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{E\+I\+N\+A\+\_\+\+F\+A\+L\+SE} on failure.
\end{DoxyReturn}
This enables (if possible on your platform) a signal handler for S\+I\+G\+B\+US, that replaces the \char`\"{}bad page\char`\"{} with a page of 0\textquotesingle{}s (from /dev/zero) if a S\+I\+G\+B\+US occurs. This allows for safe \hyperlink{group__Escape__Mman_ga1a69b9ee2b96ed0934c9f9c433f348ce}{mmap()} of files that may truncate or from files on devices with IO errors. Normally these cases will result in a S\+I\+G\+B\+US being delivered (and termination of your process), but when \char`\"{}mmap safety\char`\"{} is enabled, this will not occur. Instead a page of bytes of the value 0 will replace the \char`\"{}bad page\char`\"{}, allowing the process to continue and allow its own parsing error detection to safely abort the operation without the process falling apart.

If you disable mmap safety, the S\+I\+G\+B\+US handler will be restored to its default handler. Note that \hyperlink{group__Eina__File__Group_ga880f977c352766672d54991421835e7d}{eina\+\_\+file\+\_\+map\+\_\+all()} and \hyperlink{group__Eina__File__Group_ga8a9f5b50c7a12340421da059501660be}{eina\+\_\+file\+\_\+map\+\_\+new()} will automatically enable mmap safety as they provide an mmaped file IO layer, and rely on mmap to not fail for any part of the file.

If you set up your own S\+I\+G\+B\+US handler, then this will effectively disable the safe mmap handling and make you liable to crashes on IO to or from such \char`\"{}damaged files\char`\"{} that would take down your process.

\begin{DoxySince}{Since}
1.\+1.\+0 
\end{DoxySince}


References eina\+\_\+cpu\+\_\+page\+\_\+size(), E\+I\+N\+A\+\_\+\+F\+A\+L\+SE, E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+C\+O\+L\+O\+R\+\_\+\+D\+E\+F\+A\+U\+LT, eina\+\_\+log\+\_\+domain\+\_\+register(), E\+I\+N\+A\+\_\+\+L\+O\+G\+\_\+\+E\+RR, and fcntl().



Referenced by eet\+\_\+identity\+\_\+open(), and eet\+\_\+identity\+\_\+print().

\mbox{\Hypertarget{group__Eina__Mmap__Group_ga1aee5310614057b6dc62a67564ec6a2a}\label{group__Eina__Mmap__Group_ga1aee5310614057b6dc62a67564ec6a2a}} 
\index{Mmap Group@{Mmap Group}!eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get@{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get}}
\index{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get@{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get}!Mmap Group@{Mmap Group}}
\subsubsection{\texorpdfstring{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get()}{eina\_mmap\_safety\_enabled\_get()}}
{\footnotesize\ttfamily \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+get (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get the enabled state of mmap safety. 

\begin{DoxyReturn}{Returns}
The safety state (\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{E\+I\+N\+A\+\_\+\+T\+R\+UE} if enabled)
\end{DoxyReturn}
This returns the mmap safety state set by \hyperlink{group__Eina__Mmap__Group_ga3452104185eaee1f8d9acab09561e037}{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set()}. See \hyperlink{group__Eina__Mmap__Group_ga3452104185eaee1f8d9acab09561e037}{eina\+\_\+mmap\+\_\+safety\+\_\+enabled\+\_\+set()} for more information.

\begin{DoxySince}{Since}
1.\+1.\+0 
\end{DoxySince}
