fgms 0.11.8
The
FlightGear MultiPlayer Server
project
cDaemon Class Reference

Implement everything necessary to become a daemon. More...

#include <daemon.hxx>

Public Member Functions

 cDaemon ()
 Connect some signals at startup. These are connected to cDaemon::SigHandler. More...
 
 ~cDaemon ()
 

Static Public Member Functions

static void AddChild (pid_t ChildsPid)
 Inserts the ChildsPid in the list of our Children. So we can keep track of them and kill them if necessary, e.g. the daemon dies. More...
 
static int Daemonize ()
 Installs the signal-handler and makes ourself a daemon. More...
 
static int GetPid ()
 Return pid of deamon. More...
 
static void KillAllChildren ()
 Kill our children and ourself. More...
 
static int NumChildren ()
 Get the count of child processes. More...
 
static void SigHandler (int SigType)
 Signal Handler connected in constructor. More...
 

Static Private Attributes

static list< pid_t > Children
 keep track of our children More...
 
static pid_t PidOfDaemon
 remember who we are More...
 

Detailed Description

Implement everything necessary to become a daemon.

Definition at line 43 of file daemon.hxx.

Constructor & Destructor Documentation

cDaemon::cDaemon ( )

Connect some signals at startup. These are connected to cDaemon::SigHandler.

Definition at line 239 of file daemon.cxx.

cDaemon::~cDaemon ( )

Definition at line 253 of file daemon.cxx.

Member Function Documentation

void cDaemon::AddChild ( pid_t  ChildsPid)
static

Inserts the ChildsPid in the list of our Children. So we can keep track of them and kill them if necessary, e.g. the daemon dies.

Parameters
ChildsPidint with pid

Definition at line 219 of file daemon.cxx.

int cDaemon::Daemonize ( )
static

Installs the signal-handler and makes ourself a daemon.

Return values
int-1 or error, 0 for success

Definition at line 168 of file daemon.cxx.

Referenced by main().

static int cDaemon::GetPid ( )
inlinestatic

Return pid of deamon.

Definition at line 61 of file daemon.hxx.

void cDaemon::KillAllChildren ( )
static

Kill our children and ourself.

Definition at line 196 of file daemon.cxx.

int cDaemon::NumChildren ( )
static

Get the count of child processes.

Return values
intNo of child processes

Definition at line 229 of file daemon.cxx.

void cDaemon::SigHandler ( int  SigType)
static

Signal Handler connected in constructor.

Parameters
SigTypeThe type of signal

Definition at line 49 of file daemon.cxx.

Referenced by cDaemon().

Member Data Documentation

list< pid_t > cDaemon::Children
staticprivate

keep track of our children

Definition at line 49 of file daemon.hxx.

Referenced by AddChild(), KillAllChildren(), and NumChildren().

pid_t cDaemon::PidOfDaemon
staticprivate

remember who we are

Definition at line 46 of file daemon.hxx.

Referenced by cDaemon(), and Daemonize().


The documentation for this class was generated from the following files: