\hypertarget{group__Ecore__FD__Handler__Group}{}\section{File Descriptor Handling Functions}
\label{group__Ecore__FD__Handler__Group}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}}


Functions that deal with file descriptor handlers.  


\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{}typedef struct \+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler}\label{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}

\begin{DoxyCompactList}\small\item\em A handle for Fd handlers. \end{DoxyCompactList}\item 
\hypertarget{group__Ecore__FD__Handler__Group_ga76a17080e07857131d965c0d33b3b08a}{}typedef enum \hyperlink{group__Ecore__FD__Handler__Group_gab5644f471dfa3bd182619601d9b60608}{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags} {\bfseries Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}\label{group__Ecore__FD__Handler__Group_ga76a17080e07857131d965c0d33b3b08a}

\item 
\hypertarget{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{}typedef \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}($\ast$ \hyperlink{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{Ecore\+\_\+\+Fd\+\_\+\+Cb}) (void $\ast$data, \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler)\label{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}

\begin{DoxyCompactList}\small\item\em A callback used by an \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler}. \end{DoxyCompactList}\item 
\hypertarget{group__Ecore__FD__Handler__Group_ga952e6571562a3b520324bd5886a5aa09}{}typedef void($\ast$ \hyperlink{group__Ecore__FD__Handler__Group_ga952e6571562a3b520324bd5886a5aa09}{Ecore\+\_\+\+Fd\+\_\+\+Prep\+\_\+\+Cb}) (void $\ast$data, \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler)\label{group__Ecore__FD__Handler__Group_ga952e6571562a3b520324bd5886a5aa09}

\begin{DoxyCompactList}\small\item\em A callback used by an \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler}. \end{DoxyCompactList}\item 
\hypertarget{group__Ecore__FD__Handler__Group_ga5e06d04e8615c08688fe64876b8d03fc}{}typedef \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool}($\ast$ \hyperlink{group__Ecore__FD__Handler__Group_ga5e06d04e8615c08688fe64876b8d03fc}{Ecore\+\_\+\+Win32\+\_\+\+Handle\+\_\+\+Cb}) (void $\ast$data, \hyperlink{group__Ecore__Event__Group_ga0b36f54d74bcfb8dc622844d959c9b64}{Ecore\+\_\+\+Win32\+\_\+\+Handler} $\ast$wh)\label{group__Ecore__FD__Handler__Group_ga5e06d04e8615c08688fe64876b8d03fc}

\begin{DoxyCompactList}\small\item\em A callback used by an \hyperlink{group__Ecore__Event__Group_ga0b36f54d74bcfb8dc622844d959c9b64}{Ecore\+\_\+\+Win32\+\_\+\+Handler}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group__Ecore__FD__Handler__Group_gab5644f471dfa3bd182619601d9b60608}{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags} \{ \\*
\hyperlink{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a1699f804eccf88e7e169a4a20f1d44e7}{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D} = 1, 
\\*
\hyperlink{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a654f7e6af4875742c5349c2cc55d1bab}{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E} = 2, 
\\*
\hyperlink{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a829d91235e3ca5eba61330c96a8074de}{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R} = 4
 \}\begin{DoxyCompactList}\small\item\em What to monitor the file descriptor for\+: reading, writing or error. \end{DoxyCompactList}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$ \hyperlink{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add} (int fd, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags, \hyperlink{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{Ecore\+\_\+\+Fd\+\_\+\+Cb} func, const void $\ast$data, \hyperlink{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{Ecore\+\_\+\+Fd\+\_\+\+Cb} buf\+\_\+func, const void $\ast$buf\+\_\+data)
\begin{DoxyCompactList}\small\item\em Adds a callback for activity on the given file descriptor. \end{DoxyCompactList}\item 
\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$ \hyperlink{group__Ecore__FD__Handler__Group_gafd16a06dfe5b638dc5ecb76c7ad04f59}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add} (int fd, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags, \hyperlink{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{Ecore\+\_\+\+Fd\+\_\+\+Cb} func, const void $\ast$data, \hyperlink{group__Ecore__FD__Handler__Group_ga233a4c637db3fe2257c08ef64ca42b4a}{Ecore\+\_\+\+Fd\+\_\+\+Cb} buf\+\_\+func, const void $\ast$buf\+\_\+data)
\begin{DoxyCompactList}\small\item\em Adds a callback for activity on the given file descriptor. \end{DoxyCompactList}\item 
void \hyperlink{group__Ecore__FD__Handler__Group_ga072d1719e94e56639abcd385f7cbc692}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set} (\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler, \hyperlink{group__Ecore__FD__Handler__Group_ga952e6571562a3b520324bd5886a5aa09}{Ecore\+\_\+\+Fd\+\_\+\+Prep\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set the prepare callback with data for a given \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler}. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__FD__Handler__Group_gaf92ef3a4a006a02e67b9806276f7312c}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del} (\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler)
\begin{DoxyCompactList}\small\item\em Marks an F\+D handler for deletion. \end{DoxyCompactList}\item 
int \hyperlink{group__Ecore__FD__Handler__Group_ga70d418717552a5258c7dfc1153250e7d}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get} (\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler)
\begin{DoxyCompactList}\small\item\em Retrieves the file descriptor that the given handler is handling. \end{DoxyCompactList}\item 
\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\+\_\+\+Bool} \hyperlink{group__Ecore__FD__Handler__Group_gabd3040bd39c95723e42a8c48484b87de}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get} (\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags)
\begin{DoxyCompactList}\small\item\em Gets which flags are active on an F\+D handler. \end{DoxyCompactList}\item 
void \hyperlink{group__Ecore__FD__Handler__Group_gac7d30608fdd863ebde9a7870e2e7f1ff}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set} (\hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$fd\+\_\+handler, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags)
\begin{DoxyCompactList}\small\item\em Set what active streams the given F\+D handler should be monitoring. \end{DoxyCompactList}\item 
\hyperlink{group__Ecore__Event__Group_ga0b36f54d74bcfb8dc622844d959c9b64}{Ecore\+\_\+\+Win32\+\_\+\+Handler} $\ast$ \hyperlink{group__Ecore__FD__Handler__Group_gaf1975a3e95a585aa98a367a39dc29074}{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add} (void $\ast$h, \hyperlink{group__Ecore__FD__Handler__Group_ga5e06d04e8615c08688fe64876b8d03fc}{Ecore\+\_\+\+Win32\+\_\+\+Handle\+\_\+\+Cb} func, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Create a Ecore\+\_\+\+Win32\+\_\+\+Handler object and add it to the win32\+\_\+handlers list. \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{group__Ecore__FD__Handler__Group_ga844591195a8215ceca77a6635222b07d}{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del} (\hyperlink{group__Ecore__Event__Group_ga0b36f54d74bcfb8dc622844d959c9b64}{Ecore\+\_\+\+Win32\+\_\+\+Handler} $\ast$win32\+\_\+handler)
\begin{DoxyCompactList}\small\item\em Set Ecore\+\_\+\+Win32\+\_\+\+Handler object to delete state. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Functions that deal with file descriptor handlers. 

File descriptor handlers facilitate reading, writing and checking for errors without blocking the program or doing expensive pooling. This can be used to monitor a socket, pipe, or other stream for which an F\+D can be had.

\begin{DoxyWarning}{Warning}
File descriptor handlers can\textquotesingle{}t be used to monitor for file creation, modification or deletion, see \hyperlink{group__Ecore__File__Group}{Ecore\+\_\+\+File -\/ Files and directories convenience functions} for this.
\end{DoxyWarning}
One common F\+D to be monitored is the standard input(stdin), monitoring it for reading requires a single call\+: 
\begin{DoxyCode}
\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_my\_cb\_func(\textcolor{keywordtype}{void} *data, \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\_Fd\_Handler} *handler)
\{
   \textcolor{keywordtype}{char} c;
   scanf(\textcolor{stringliteral}{"%c"}, &c); \textcolor{comment}{//Guaranteed not to block}
   ... \textcolor{keywordflow}{do} stuff with c ...
\}
\hyperlink{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}{ecore\_main\_fd\_handler\_add}(STDIN\_FILENO, ECORE\_FD\_READ, \_my\_cb\_func, NULL, NULL, 
      NULL);
\end{DoxyCode}


When using a socket, pipe or other stream it\textquotesingle{}s important to remember that errors may occur and as such to monitor not only for reading/writing but also for errors using the \hyperlink{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a829d91235e3ca5eba61330c96a8074de}{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R} flag.

Example of use of a file descriptor handler\+: \begin{DoxyItemize}
\item \hyperlink{ecore_fd_handler_example_c}{ecore fd handlers -\/ Monitoring file descriptors} \end{DoxyItemize}


\subsection{Enumeration Type Documentation}
\hypertarget{group__Ecore__FD__Handler__Group_gab5644f471dfa3bd182619601d9b60608}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags@{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}}
\index{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags@{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{\+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \+\_\+\+Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}}\label{group__Ecore__FD__Handler__Group_gab5644f471dfa3bd182619601d9b60608}


What to monitor the file descriptor for\+: reading, writing or error. 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D}}\item[{\em 
\hypertarget{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a1699f804eccf88e7e169a4a20f1d44e7}{}E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D\label{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a1699f804eccf88e7e169a4a20f1d44e7}
}]Fd Read mask. \index{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E}}\item[{\em 
\hypertarget{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a654f7e6af4875742c5349c2cc55d1bab}{}E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E\label{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a654f7e6af4875742c5349c2cc55d1bab}
}]Fd Write mask. \index{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R@{E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R}}\item[{\em 
\hypertarget{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a829d91235e3ca5eba61330c96a8074de}{}E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R\label{group__Ecore__FD__Handler__Group_ggab5644f471dfa3bd182619601d9b60608a829d91235e3ca5eba61330c96a8074de}
}]Fd Error mask. \end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add(int fd, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags, Ecore\+\_\+\+Fd\+\_\+\+Cb func, const void $\ast$data, Ecore\+\_\+\+Fd\+\_\+\+Cb buf\+\_\+func, const void $\ast$buf\+\_\+data)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler}$\ast$ ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}]{flags, }
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data, }
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Cb}}]{buf\+\_\+func, }
\item[{const void $\ast$}]{buf\+\_\+data}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}


Adds a callback for activity on the given file descriptor. 


\begin{DoxyParams}{Parameters}
{\em fd} & The file descriptor to watch. \\
\hline
{\em flags} & To monitor it for reading use {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D}, for writing {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E}, and for error {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R}. Values by $\vert$(ored). \\
\hline
{\em func} & The callback function. \\
\hline
{\em data} & The data to pass to the callback. \\
\hline
{\em buf\+\_\+func} & The function to call to check if any data has been buffered and already read from the fd. May be {\ttfamily N\+U\+L\+L}. \\
\hline
{\em buf\+\_\+data} & The data to pass to the {\ttfamily buf\+\_\+func} function. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A fd handler handle on success, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
{\itshape func} will be called during the execution of \hyperlink{Ecore_Main_Loop_Page}{The Ecore Main Loop} when the file descriptor is available for reading, writing, or there has been an error(depending on the given {\itshape flags}).

When {\itshape func} returns E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L, it indicates that the handler should be marked for deletion (identical to calling \hyperlink{group__Ecore__FD__Handler__Group_gaf92ef3a4a006a02e67b9806276f7312c}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del}).

\begin{DoxyWarning}{Warning}
{\itshape buf\+\_\+func} is meant for {\bfseries internal} use only and should be {\bfseries avoided}.
\end{DoxyWarning}
The return value of {\itshape buf\+\_\+func} has a different meaning, when it returns E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+A\+N\+C\+E\+L, it indicates that {\itshape func} {\bfseries shouldn\textquotesingle{}t} be called, and when it returns E\+C\+O\+R\+E\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+N\+E\+W it indicates {\itshape func} should be called. The return value of {\itshape buf\+\_\+func} will not cause the F\+D handler to be deleted.

{\itshape buf\+\_\+func} is called during event loop handling to check if data that has been read from the file descriptor is in a buffer and is available to read. Some systems, notably xlib, handle their own buffering, and would otherwise not work with select(). These systems should use a {\itshape buf\+\_\+func}. This is a most annoying hack, only ecore\+\_\+x uses it, so refer to that for an example.

\begin{DoxyWarning}{Warning}
This function should {\bfseries not} be used for monitoring \char`\"{}normal\char`\"{} files, like text files. 
\end{DoxyWarning}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_evas_basics_example_8c-example}{ecore\+\_\+evas\+\_\+basics\+\_\+example.\+c}, \hyperlink{ecore_exe_example_child_8c-example}{ecore\+\_\+exe\+\_\+example\+\_\+child.\+c}, \hyperlink{ecore_fd_handler_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+example.\+c}, and \hyperlink{ecore_fd_handler_gnutls_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+gnutls\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, and E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.



Referenced by ecore\+\_\+evas\+\_\+init(), ecore\+\_\+fb\+\_\+input\+\_\+device\+\_\+listen(), ecore\+\_\+pipe\+\_\+full\+\_\+add(), ecore\+\_\+pipe\+\_\+thaw(), ecore\+\_\+wl\+\_\+init(), ecore\+\_\+x\+\_\+init(), and eeze\+\_\+udev\+\_\+watch\+\_\+add().

\hypertarget{group__Ecore__FD__Handler__Group_gafd16a06dfe5b638dc5ecb76c7ad04f59}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add(int fd, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags, Ecore\+\_\+\+Fd\+\_\+\+Cb func, const void $\ast$data, Ecore\+\_\+\+Fd\+\_\+\+Cb buf\+\_\+func, const void $\ast$buf\+\_\+data)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler}$\ast$ ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+file\+\_\+add (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}]{flags, }
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data, }
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Cb}}]{buf\+\_\+func, }
\item[{const void $\ast$}]{buf\+\_\+data}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_gafd16a06dfe5b638dc5ecb76c7ad04f59}


Adds a callback for activity on the given file descriptor. 


\begin{DoxyParams}{Parameters}
{\em fd} & The file descriptor to watch. \\
\hline
{\em flags} & To monitor it for reading use {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D}, for writing {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E}, and for error {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R}. Values by $\vert$(ored). \\
\hline
{\em func} & The callback function. \\
\hline
{\em data} & The data to pass to the callback. \\
\hline
{\em buf\+\_\+func} & The function to call to check if any data has been buffered and already read from the fd. May be {\ttfamily N\+U\+L\+L}. \\
\hline
{\em buf\+\_\+data} & The data to pass to the {\ttfamily buf\+\_\+func} function. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A fd handler handle on success, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
This function is identical to ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add, except that it supports regular files. \begin{DoxyWarning}{Warning}
This function should O\+N\+L\+Y be called with E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R, otherwise it will call the fd handler constantly. 

Do not use this function unless you know what you are doing.
\end{DoxyWarning}
\begin{DoxySince}{Since}
1.\+7 
\end{DoxySince}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L, and E\+I\+N\+A\+\_\+\+T\+R\+U\+E.



Referenced by eeze\+\_\+mount\+\_\+tabs\+\_\+watch().

\hypertarget{group__Ecore__FD__Handler__Group_ga072d1719e94e56639abcd385f7cbc692}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set(\+Ecore\+\_\+\+Fd\+\_\+\+Handler $\ast$fd\+\_\+handler, Ecore\+\_\+\+Fd\+\_\+\+Prep\+\_\+\+Cb func, const void $\ast$data)}]{\setlength{\rightskip}{0pt plus 5cm}void ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+prepare\+\_\+callback\+\_\+set (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$}]{fd\+\_\+handler, }
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Prep\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_ga072d1719e94e56639abcd385f7cbc692}


Set the prepare callback with data for a given \hyperlink{group__Ecore__FD__Handler__Group_ga225121ed2123da4b52b76aa08d78c220}{Ecore\+\_\+\+Fd\+\_\+\+Handler}. 


\begin{DoxyParams}{Parameters}
{\em fd\+\_\+handler} & The fd handler \\
\hline
{\em func} & The prep function \\
\hline
{\em data} & The data to pass to the prep function\\
\hline
\end{DoxyParams}
This function will be called prior to any fd handler\textquotesingle{}s callback function (even the other fd handlers), before entering the main loop select function.

\begin{DoxyNote}{Note}
Once a prepare callback is set for a fd handler, it cannot be changed. You need to delete the fd handler and create a new one, to set another callback. 

You probably don\textquotesingle{}t need this function. It is only necessary for very uncommon cases that need special behavior. 
\end{DoxyNote}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_fd_handler_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+example.\+c}.\end{Desc}


References eina\+\_\+list\+\_\+append(), eina\+\_\+list\+\_\+data\+\_\+find(), and E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N.

\hypertarget{group__Ecore__FD__Handler__Group_gaf92ef3a4a006a02e67b9806276f7312c}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del(\+Ecore\+\_\+\+Fd\+\_\+\+Handler $\ast$fd\+\_\+handler)}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$}]{fd\+\_\+handler}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_gaf92ef3a4a006a02e67b9806276f7312c}


Marks an F\+D handler for deletion. 


\begin{DoxyParams}{Parameters}
{\em fd\+\_\+handler} & The F\+D handler. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The data pointer set using \hyperlink{group__Ecore__FD__Handler__Group_ga832e68eb7f15912abeadef816bb5d2f5}{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+add}, for {\itshape fd\+\_\+handler} on success, {\ttfamily N\+U\+L\+L} otherwise. This function marks an fd handler to be deleted during an iteration of the main loop. It does N\+O\+T close the associated fd!
\end{DoxyReturn}
\begin{DoxyWarning}{Warning}
If the underlying fd is already closed ecore may complain if the main loop is using epoll internally, and also in some rare cases this may cause crashes and instability. Remember to delete your fd handlers before the fds they listen to are closed. 
\end{DoxyWarning}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_fd_handler_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.



Referenced by ecore\+\_\+avahi\+\_\+del(), ecore\+\_\+con\+\_\+url\+\_\+shutdown(), ecore\+\_\+evas\+\_\+shutdown(), eeze\+\_\+mount\+\_\+tabs\+\_\+unwatch(), and eeze\+\_\+udev\+\_\+watch\+\_\+del().

\hypertarget{group__Ecore__FD__Handler__Group_ga70d418717552a5258c7dfc1153250e7d}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get(\+Ecore\+\_\+\+Fd\+\_\+\+Handler $\ast$fd\+\_\+handler)}]{\setlength{\rightskip}{0pt plus 5cm}int ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+fd\+\_\+get (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$}]{fd\+\_\+handler}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_ga70d418717552a5258c7dfc1153250e7d}


Retrieves the file descriptor that the given handler is handling. 


\begin{DoxyParams}{Parameters}
{\em fd\+\_\+handler} & The given F\+D handler. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The file descriptor the handler is watching. 
\end{DoxyReturn}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_fd_handler_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L.

\hypertarget{group__Ecore__FD__Handler__Group_gabd3040bd39c95723e42a8c48484b87de}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get(\+Ecore\+\_\+\+Fd\+\_\+\+Handler $\ast$fd\+\_\+handler, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Eina\+\_\+\+Bool} ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+get (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$}]{fd\+\_\+handler, }
\item[{Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}]{flags}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_gabd3040bd39c95723e42a8c48484b87de}


Gets which flags are active on an F\+D handler. 


\begin{DoxyParams}{Parameters}
{\em fd\+\_\+handler} & The given F\+D handler. \\
\hline
{\em flags} & The flags, {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D}, {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E} or {\ttfamily E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R} to query. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
{\ttfamily E\+I\+N\+A\+\_\+\+T\+R\+U\+E} if any of the given flags are active, {\ttfamily E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E} otherwise. 
\end{DoxyReturn}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_fd_handler_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+example.\+c}.\end{Desc}


References E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+E\+R\+R\+O\+R, E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+R\+E\+A\+D, E\+C\+O\+R\+E\+\_\+\+F\+D\+\_\+\+W\+R\+I\+T\+E, E\+I\+N\+A\+\_\+\+F\+A\+L\+S\+E, E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+A\+L, and E\+I\+N\+A\+\_\+\+T\+R\+U\+E.

\hypertarget{group__Ecore__FD__Handler__Group_gac7d30608fdd863ebde9a7870e2e7f1ff}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set}}
\index{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set@{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set(\+Ecore\+\_\+\+Fd\+\_\+\+Handler $\ast$fd\+\_\+handler, Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags flags)}]{\setlength{\rightskip}{0pt plus 5cm}void ecore\+\_\+main\+\_\+fd\+\_\+handler\+\_\+active\+\_\+set (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Fd\+\_\+\+Handler} $\ast$}]{fd\+\_\+handler, }
\item[{Ecore\+\_\+\+Fd\+\_\+\+Handler\+\_\+\+Flags}]{flags}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_gac7d30608fdd863ebde9a7870e2e7f1ff}


Set what active streams the given F\+D handler should be monitoring. 


\begin{DoxyParams}{Parameters}
{\em fd\+\_\+handler} & The given F\+D handler. \\
\hline
{\em flags} & The flags to be watching. \\
\hline
\end{DoxyParams}
\begin{Desc}
\item[Examples\+: ]\par
\hyperlink{ecore_fd_handler_gnutls_example_8c-example}{ecore\+\_\+fd\+\_\+handler\+\_\+gnutls\+\_\+example.\+c}.\end{Desc}


References E\+I\+N\+A\+\_\+\+M\+A\+I\+N\+\_\+\+L\+O\+O\+P\+\_\+\+C\+H\+E\+C\+K\+\_\+\+R\+E\+T\+U\+R\+N, and E\+R\+R.

\hypertarget{group__Ecore__FD__Handler__Group_gaf1975a3e95a585aa98a367a39dc29074}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add@{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add}}
\index{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add@{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add(void $\ast$h, Ecore\+\_\+\+Win32\+\_\+\+Handle\+\_\+\+Cb func, const void $\ast$data)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ecore\+\_\+\+Win32\+\_\+\+Handler}$\ast$ ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+add (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{h, }
\item[{{\bf Ecore\+\_\+\+Win32\+\_\+\+Handle\+\_\+\+Cb}}]{func, }
\item[{const void $\ast$}]{data}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_gaf1975a3e95a585aa98a367a39dc29074}


Create a Ecore\+\_\+\+Win32\+\_\+\+Handler object and add it to the win32\+\_\+handlers list. 


\begin{DoxyParams}{Parameters}
{\em h} & The win32 handler. \\
\hline
{\em func} & The function to add as a callback. \\
\hline
{\em data} & The data to pass to the callback when it is called. \\
\hline
\end{DoxyParams}
\hypertarget{group__Ecore__FD__Handler__Group_ga844591195a8215ceca77a6635222b07d}{}\index{File Descriptor Handling Functions@{File Descriptor Handling Functions}!ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del@{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del}}
\index{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del@{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del}!File Descriptor Handling Functions@{File Descriptor Handling Functions}}
\subsubsection[{ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del(\+Ecore\+\_\+\+Win32\+\_\+\+Handler $\ast$win32\+\_\+handler)}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ ecore\+\_\+main\+\_\+win32\+\_\+handler\+\_\+del (
\begin{DoxyParamCaption}
\item[{{\bf Ecore\+\_\+\+Win32\+\_\+\+Handler} $\ast$}]{win32\+\_\+handler}
\end{DoxyParamCaption}
)}\label{group__Ecore__FD__Handler__Group_ga844591195a8215ceca77a6635222b07d}


Set Ecore\+\_\+\+Win32\+\_\+\+Handler object to delete state. 

The handler will be deleted in the \+\_\+ecore\+\_\+main\+\_\+win32\+\_\+handlers\+\_\+cleanup function.


\begin{DoxyParams}{Parameters}
{\em win32\+\_\+handler} & The Ecore\+\_\+\+Win32\+\_\+\+Handler object. \\
\hline
\end{DoxyParams}
