\hypertarget{daemonize_8c}{
\section{src/daemonize.c File Reference}
\label{daemonize_8c}\index{src/daemonize.c@{src/daemonize.c}}
}
{\ttfamily \#include $<$stdio.h$>$}\par
{\ttfamily \#include $<$unistd.h$>$}\par
{\ttfamily \#include $<$stdlib.h$>$}\par
Include dependency graph for daemonize.c:
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{daemonize_8c_a29b0af1da2432bcc90721c0b62f4e660}{daemonize} (void)
\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{daemonize_8c_a29b0af1da2432bcc90721c0b62f4e660}{
\index{daemonize.c@{daemonize.c}!daemonize@{daemonize}}
\index{daemonize@{daemonize}!daemonize.c@{daemonize.c}}
\subsubsection[{daemonize}]{\setlength{\rightskip}{0pt plus 5cm}void daemonize (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{daemonize_8c_a29b0af1da2432bcc90721c0b62f4e660}


Definition at line 6 of file daemonize.c.


\begin{DoxyCode}
                     {
    pid_t pid;

    if (0 > ((pid = fork()))) {
        perror("deamoinze[fork]");
        exit(EXIT_FAILURE);
    } else if (0 != pid) {
        exit(EXIT_SUCCESS);
    }

    /* make new child session leader */
    setsid();

    /* connect all standard streams to /dev/null */
    stderr = freopen("/dev/null", "w", stderr);
    stdin  = freopen("/dev/null", "r", stdin);
    stdout = freopen("/dev/null", "w", stdout);
}
\end{DoxyCode}
