\doxysection{src/core/application.c File Reference}
\label{application_8c}\index{src/core/application.c@{src/core/application.c}}


Routines for helping with the osmocom application setup.  


{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$osmocom/core/application.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$signal.\+h$>$}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$sys/stat.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \textbf{ sighup\+\_\+hdlr} (int signal)
\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{ log\+\_\+info})
\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_8c_aa6ae82e2c37662eda7093d3db1b3b830}} 
\index{application.c@{application.c}!osmo\_daemonize@{osmo\_daemonize}}
\index{osmo\_daemonize@{osmo\_daemonize}!application.c@{application.c}}
\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_8c_a38dc37d2cf97c98bcb1d713794ff2a75}} 
\index{application.c@{application.c}!osmo\_init\_ignore\_signals@{osmo\_init\_ignore\_signals}}
\index{osmo\_init\_ignore\_signals@{osmo\_init\_ignore\_signals}!application.c@{application.c}}
\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_8c_a44188167ba583111b73c1bd983ffe32f}} 
\index{application.c@{application.c}!osmo\_init\_logging@{osmo\_init\_logging}}
\index{osmo\_init\_logging@{osmo\_init\_logging}!application.c@{application.c}}
\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_8c_a4b11cf941dd9e32e89bd24d56a808ecc}} 
\index{application.c@{application.c}!osmo\_init\_logging2@{osmo\_init\_logging2}}
\index{osmo\_init\_logging2@{osmo\_init\_logging2}!application.c@{application.c}}
\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()}.

\mbox{\label{application_8c_a4f4e1198dab0d79568b59722aceba92c}} 
\index{application.c@{application.c}!sighup\_hdlr@{sighup\_hdlr}}
\index{sighup\_hdlr@{sighup\_hdlr}!application.c@{application.c}}
\doxysubsubsection{sighup\_hdlr()}
{\footnotesize\ttfamily static void sighup\+\_\+hdlr (\begin{DoxyParamCaption}\item[{int}]{signal }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ log\+\_\+targets\+\_\+reopen()}.



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



\doxysubsection{Variable Documentation}
\mbox{\label{application_8c_a2f56746f90c8f8065e8f33c007e5505e}} 
\index{application.c@{application.c}!osmo\_stderr\_target@{osmo\_stderr\_target}}
\index{osmo\_stderr\_target@{osmo\_stderr\_target}!application.c@{application.c}}
\doxysubsubsection{osmo\_stderr\_target}
{\footnotesize\ttfamily struct \textbf{ log\+\_\+target}$\ast$ osmo\+\_\+stderr\+\_\+target}



the default logging target, logging to stderr 



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

