]> git.ozlabs.org Git - ccan/blob - ccan/daemonize/daemonize.h
daemonize module
[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  * (ie. fork() 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, stdout and stderr file descriptors are closed
14  *  - Current working directory changes to /
15  *  - Umask is set to 0.
16  */
17 bool daemonize(void);
18
19 #endif /* CCAN_DAEMONIZE_H */