daemonize.h 543 B

12345678910111213141516171819
  1. #ifndef CCAN_DAEMONIZE_H
  2. #define CCAN_DAEMONIZE_H
  3. #include <stdbool.h>
  4. /**
  5. * daemonize - turn this process into a daemon.
  6. *
  7. * This routine forks us off to become a daemon. It returns false on failure
  8. * (ie. fork() failed) and sets errno.
  9. *
  10. * Side effects for programmers to be aware of:
  11. * - PID changes (our parent exits, we become child of init)
  12. * - stdin, stdout and stderr file descriptors are closed
  13. * - Current working directory changes to /
  14. * - Umask is set to 0.
  15. */
  16. bool daemonize(void);
  17. #endif /* CCAN_DAEMONIZE_H */