1 #ifndef CCAN_DAEMON_WITH_NOTIFY_H
2 #define CCAN_DAEMON_WITH_NOTIFY_H
5 * daemonize - turns this process into a daemon
7 * This routine will fork() us off to become a daemon. It will return
8 * -1 on error and 0 on success.
10 * It has a few optional behaviours:
11 * @nochdir: if nochdir is set, it won't chdir to /
12 * this means we could hold onto mounts
13 * @noclose: if noclose is set, we won't close stdout, stdin and stderr.
14 * @wait_sigusr1: if wait_sigusr1 is set, the parent will not exit until the
15 * child has either exited OR it receives a SIGUSR1 signal. You can use this
16 * to have the parent only exit when your process has done all the
17 * danegerous initialization that could cause it to fail to start
18 * (e.g. allocating large amounts of memory, replaying REDO logs).
19 * This allows init scripts starting the daemon to easily report
22 int daemonize(int nochdir, int noclose, int wait_sigusr1);
25 * daemon_is_ready - signals parent that it can exit, we started okay
27 * After a daemonize() call, this function will send a SIGUSR1 to the parent
28 * telling it to exit as we have started up okay.
30 int daemon_is_ready(void);
32 #endif /* CCAN_DAEMON_WITH_NOTIFY_H */