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