daemonize_8c.tex
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
\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}