class DD_garbage_d

Class DD_garbage_d: class that encapsulates the DD garbage demon process.

Public Methods

[more] DD_garbage_d( const char* cpDD_name = DD::pccDefaultDDName, char* cpDD_config_file = NULL)
Creator.
[more] ~DD_garbage_d()
Destructor.
[more]int working()
Removes the volatile buffers.
[more]void check_dd()
Checks whether the DD is still ok.
[more]static int start_garbage_d( pid_t &pid, const char* dd_name = DD::pccDefaultDDName, const char* dd_config_file = DD::pccDefaultDDFileName )
Static member that starts the garbage demon.
[more]static int stop_garbage_d(pid_t pid)
Stops the garbage demon and cleans up the DD system.
[more]FILE* get_logfile()
Returns the logfile of the garbage demon
[more]void set_timer( Timer* theTimer )
Sets the timer of the demon
[more]BOOL dd_not_in_use()
Returns true if the DD system is not in use
[more]BOOL dd_in_use()
Returns true if the DD system is in use


Documentation

Class DD_garbage_d: class that encapsulates the DD garbage demon process.

The DD_garbage_d process fulfills the following functions:

The garbage demon is a process with his own fifo. It is started by the process which creates the DD system by calling the static member function DD_garbage_d::start_garbage_d. In the main part of the garbage_d program (in file dd_garbage_main.cc) we construct one instance of the DD_garbage_d class, which then does all the work.

For the most part of his life the garbage demon sleeps on the semaphore for the GARBAGE fifo where he receives a volatile buffer. As soon as one or many arrive he deletes them.
Internally the garbage demon has also a timer (class Timer - see package otools for details) which calls periodically the static function check_eodd from where the periodic functions are done as outlined above.

The garbage demon has also responses to the signal DD_SHUTDOWN_SIGNAL (currently SIGHUP, see header file dd_signal_def.h). Upon arrival of this signal, the garbage demon informes all the processes about an imminent shutdown (by calling lDD::prepare_shutdown), waits a moment and then removes the DD system.

The garbage demon writes all the log information into a logfile. By default this logfile is put into the directory HOST.PID. If the directory is not found, the logfile is put into /tmp. If the garbage demon fails before opening the logfile, he will put an error message into the UNIX utility SYSLOG.

Modifications:

o DD_garbage_d( const char* cpDD_name = DD::pccDefaultDDName, char* cpDD_config_file = NULL)
Creator. Attaches to the DD system and starts monitoring it.

o ~DD_garbage_d()
Destructor. Note that the destructor removes the entire DD system.

oint working()
Removes the volatile buffers.
Returns:
ddcSuccess if everything is ok
ddcFailure in case of fatal DD system error
ddcInterrupted_sleep_mode if waiting for volatile buffer as been interrupted by a timer or the stop signal.

ovoid check_dd()
Checks whether the DD is still ok. Member function called from the timer. Does all the checking.

ostatic int start_garbage_d( pid_t &pid, const char* dd_name = DD::pccDefaultDDName, const char* dd_config_file = DD::pccDefaultDDFileName )
Static member that starts the garbage demon. Called by the process that creates the DD system in first place. Forks off the garbage demon, which attaches to the DD system.
Parameters:
pid - : pid of the garbage demon
dd_name - : name of the DD system
dd_config_file - : configuration file of the DD system
Returns:
ddcSuccess if no problem, ddcFailure if fatal error.

ostatic int stop_garbage_d(pid_t pid)
Stops the garbage demon and cleans up the DD system. Currently an unsupported feature.

oFILE* get_logfile()
Returns the logfile of the garbage demon

ovoid set_timer( Timer* theTimer )
Sets the timer of the demon

oBOOL dd_not_in_use()
Returns true if the DD system is not in use

oBOOL dd_in_use()
Returns true if the DD system is in use

oint open_logfile()
Opens the logfile of the demon

ovoid check_dd_sem()
Checks the semaphores of the DD processes. Every DD process has a set of semaphores attached that will be removed once the process exists. This allows the demon to check whether the process has properly exited.

ovoid remove_dd_proc( int iProc )
Removes the process with dd_pid iProc from the DD pool

ovoid fix_fifo( const Fifo_iterator &it )
Cleans up the fifo after a process did not deattach properly

oint find_dd_zombies()
Finds zombie processes. Finds processes that are attached to fifos that receive events but the fifo is never read. Such a fifo will after a while clog the entire system. The garbage demon will remove the process and clean up the fifo if the fifo is not protected.

oint update_event_flow()
Updates the information about the event flow in dd_dcom

ochar* fifo_name
name of the GARBAGE fifo

oFifo* my_fifo
Pointer to the garbage Fifo

oFILE* logfile
logfile

oDD* my_dd
Pointer to the DD system

oTimer* my_timer
Pointer to the garbage demon timer. The timer periodically interrupts the demon and makes him do all the DD system monitoring and checking. (see package otools for details on the timer).

otime_t tLast_check
Time stamp of the last check

ostruct dd_dcom_str *dd_dcom
Pointer to dd_dcom (for convenience only)

oBOOL bDD_unused
true if the DD system is not in use


This class has no child classes.
Author:
C.Witzig
Date: Jan 11, 1998
Version:
Last update: Jan 11, 1998

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.