]> git.ozlabs.org Git - ccan/blob - ccan/daemonize/daemonize.h
ccanlint: print coverage amount when -vv
[ccan] / ccan / daemonize / daemonize.h
1 #ifndef CCAN_DAEMONIZE_H
2 #define CCAN_DAEMONIZE_H
3 #include <stdbool.h>
4
5 /**
6  * daemonize - turn this process into a daemon.
7  *
8  * This routine forks us off to become a daemon.  It returns false on failure
9  * (eg. fork(), chdir or open failed) and sets errno.
10  *
11  * Side effects for programmers to be aware of:
12  *  - PID changes (our parent exits, we become child of init)
13  *  - stdin and stdout file descriptors are closed
14  *  - stderr is reopened to /dev/null so you don't reuse it
15  *  - Current working directory changes to /
16  *  - Umask is set to 0.
17  */
18 bool daemonize(void);
19
20 #endif /* CCAN_DAEMONIZE_H */