#include <dsDaemon.h>
Inheritance diagram for dsDaemon:

Public Methods | |
| dsDaemon (char *progname, int max_children=50, int flags=0) | |
| dsDaemon (char *progname, char *pid_path, int max_children=50, int flags=0) | |
| virtual | ~dsDaemon () |
| virtual int | init_globals () |
| virtual pid_t | fork_child () |
| virtual int | child_work () |
| 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) |
| dsDaemon () | |
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) |
|
|
Create unitialised daemon sceletion, use it to create derived classes only |
|
||||||||||||||||
|
Create a daemon sceletion
|
|
||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
This function does per child actions Reimplemented in dsHttpDaemon. |
|
|
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 |
|
|
|
|
|
|
|
|
|
1.3-rc2