/* * daemonize.h: a function to daemonize a process * according to daemon(7) (SysV style) */ #ifndef DAEMONIZE_H #define DAEMONIZE_H #include #include bool daemonize(uint32_t flags); // the indices correspond to items in list to do in daemon(7) // except the first one // some of them will never be used #define NODAEMONIZE (1<<0) /*Do not daemonize at all*/ #define NOCLOSEFD (1<<1) #define NORSTSIG (1<<2) #define NORSTSIGMASK (1<<3) #define NOSANITY (1<<4) // Sanitizing not implemented #define NOBGFORK (1<<5) #define NOSETSID (1<<6) #define NOSECONDFORK (1<<7) #define NOEXITCHLD (1<<8) // Not implemented -- always exit #define NOCONNECTIO (1<<9) #define NORSTUMASK (1<<10) #define NOCHANGEWD (1<<11) #define NOPIDFILE (1<<12) // Creating PID file not implemented #define NOPRIVDROP (1<<13) // Not needed #define NONOTIFY (1<<14) // Not implemented -- always notify #define NOPARENTEXIT (1<<15) // Not implemented -- always exit #endif