\doxysection{include/osmocom/core/application.h File Reference}
\label{application_8h}\index{include/osmocom/core/application.h@{include/osmocom/core/application.h}}


Routines for helping with the osmocom application setup.  


{\ttfamily \#include $<$osmocom/core/defs.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ osmo\+\_\+init\+\_\+ignore\+\_\+signals} (void)
\begin{DoxyCompactList}\small\item\em Ignore SIGPIPE, SIGALRM, SIGHUP and SIGIO. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+init\+\_\+logging} (const struct \textbf{ log\+\_\+info} $\ast$) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}use \textbf{ osmo\+\_\+init\+\_\+logging2}() \textbf{ instead} to avoid a NULL talloc ctx\char`\"{})
\begin{DoxyCompactList}\small\item\em Initialize the osmocom logging framework. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+init\+\_\+logging2} (void $\ast$ctx, const struct \textbf{ log\+\_\+info} $\ast$\textbf{ log\+\_\+info})
\item 
int \textbf{ osmo\+\_\+daemonize} (void)
\begin{DoxyCompactList}\small\item\em Turn the current process into a background daemon. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ log\+\_\+target} $\ast$ \textbf{ osmo\+\_\+stderr\+\_\+target}
\begin{DoxyCompactList}\small\item\em the default logging target, logging to stderr \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Routines for helping with the osmocom application setup. 



\doxysubsection{Function Documentation}
\mbox{\label{application_8h_aa6ae82e2c37662eda7093d3db1b3b830}} 
\index{application.h@{application.h}!osmo\_daemonize@{osmo\_daemonize}}
\index{osmo\_daemonize@{osmo\_daemonize}!application.h@{application.h}}
\doxysubsubsection{osmo\_daemonize()}
{\footnotesize\ttfamily int osmo\+\_\+daemonize (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Turn the current process into a background daemon. 

This function will fork the process, exit the parent and set umask, create a new session, close stdin/stdout/stderr and chdir to /tmp 

References \textbf{ pid}.

\mbox{\label{application_8h_a38dc37d2cf97c98bcb1d713794ff2a75}} 
\index{application.h@{application.h}!osmo\_init\_ignore\_signals@{osmo\_init\_ignore\_signals}}
\index{osmo\_init\_ignore\_signals@{osmo\_init\_ignore\_signals}!application.h@{application.h}}
\doxysubsubsection{osmo\_init\_ignore\_signals()}
{\footnotesize\ttfamily void osmo\+\_\+init\+\_\+ignore\+\_\+signals (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Ignore SIGPIPE, SIGALRM, SIGHUP and SIGIO. 



References \textbf{ sighup\+\_\+hdlr()}.

\mbox{\label{application_8h_a4fd763edd744e7df28f7c48eef0676ae}} 
\index{application.h@{application.h}!osmo\_init\_logging@{osmo\_init\_logging}}
\index{osmo\_init\_logging@{osmo\_init\_logging}!application.h@{application.h}}
\doxysubsubsection{osmo\_init\_logging()}
{\footnotesize\ttfamily int osmo\+\_\+init\+\_\+logging (\begin{DoxyParamCaption}\item[{const struct \textbf{ log\+\_\+info} $\ast$}]{log\+\_\+info }\end{DoxyParamCaption})}



Initialize the osmocom logging framework. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em \doxyref{log\+\_\+info}{p.}{structlog__info}} & Array of available logging sub-\/systems \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 in case of error
\end{DoxyReturn}
This function initializes the osmocom logging systems. It also creates the default (stderr) logging target. 

References \textbf{ osmo\+\_\+init\+\_\+logging2()}.

\mbox{\label{application_8h_a4b11cf941dd9e32e89bd24d56a808ecc}} 
\index{application.h@{application.h}!osmo\_init\_logging2@{osmo\_init\_logging2}}
\index{osmo\_init\_logging2@{osmo\_init\_logging2}!application.h@{application.h}}
\doxysubsubsection{osmo\_init\_logging2()}
{\footnotesize\ttfamily int osmo\+\_\+init\+\_\+logging2 (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{const struct \textbf{ log\+\_\+info} $\ast$}]{log\+\_\+info }\end{DoxyParamCaption})}



References \textbf{ log\+\_\+add\+\_\+target()}, \textbf{ log\+\_\+init()}, \textbf{ log\+\_\+set\+\_\+all\+\_\+filter()}, \textbf{ log\+\_\+target\+\_\+create\+\_\+stderr()}, and \textbf{ osmo\+\_\+stderr\+\_\+target}.



Referenced by \textbf{ osmo\+\_\+init\+\_\+logging()}.



\doxysubsection{Variable Documentation}
\mbox{\label{application_8h_a2f56746f90c8f8065e8f33c007e5505e}} 
\index{application.h@{application.h}!osmo\_stderr\_target@{osmo\_stderr\_target}}
\index{osmo\_stderr\_target@{osmo\_stderr\_target}!application.h@{application.h}}
\doxysubsubsection{osmo\_stderr\_target}
{\footnotesize\ttfamily struct \textbf{ log\+\_\+target}$\ast$ osmo\+\_\+stderr\+\_\+target\hspace{0.3cm}{\ttfamily [extern]}}



the default logging target, logging to stderr 



Referenced by \textbf{ osmo\+\_\+init\+\_\+logging2()}.

