Inheritance diagram for MyDaemon:
Public Methods | |
MyDaemon () | |
virtual int | init_globals () |
virtual pid_t | fork_child () |
virtual void | shutdown_child () |
virtual int | reinit () |
void | kill_running () |
Protected Methods | |
void | processPidFile () |
void | addChild (pid_t npid) |
void | removeChild (pid_t npid) |
int | waitForFreeSlot (pid_t pid) |
Friends | |
void | daemonize (dsDaemon *sd, int options=0) |
void | dsSafeSleep (int secs, int nsecs=0) |
int | DaemonFlags (char *str) |
void | SIGCHLD_hdl (int sig) |
void | SIGANY_hdl (int sig) |
void | SIGINT_hdl (int sig) |
|
|
|
|
|
fork child. Default function increase child counter and then fork. It's better to call return dsDaemon::fork_child() at the end of overloaded function. if overloaded function returns -1 (fork error) child will not be intialised. Reimplemented in dsHttpDaemon. |
|
Perform tasks after daemon detach, but before first fork all file handlers is closed to this point. Reimplemented in dsHttpDaemon. |
|
read pid file and kill running instance |
|
|
|
Function to call from SIGHUP handler. Week point use it with care. |
|
|
|
This function called when child terminated wether by SIGTERM or normally Reimplemented in dsHttpDaemon. |
|
Waits for free slot in child array, and returns number of found slot |
|
Convert text reperesentation of daemon file into binary flags |
|
Perform basic system tasks to become a daemon: close all handlers, allocate new process group and detach
|
|
safe sleep: implement sleep by nanosleep or select timer (TODO), instead of using SIGALARM or sleep() to avoid possible interference with user application |
|
|
|
|
|
|