Class for a local (same host) DD system.
Inheritance:
Public Methods
-
Creating and deleting DD systems
-
Coordination and control of the DD system
-
Member functions for FIFO manipulations
-
Inserting and accessing events in the pool
-
Member functions to set/get process specific parameters
-
Static member functions tied to the signal handling
Inherited from DD:
Public Fields
-
static const char* const pccDefaultDDName
-
static const char* const pccDefaultDDFileName
Public Methods
-
Miscellanous member functions
-
static void printUnsupportedOperation( const char* operation )
Public Members
-
enums as static data members
Protected Fields
-
BOOL is_local
-
char* name
-
char* config_file
-
char* dd_filename
-
static const char* dd_version
Documentation
Class for a local (same host) DD system.
This class implements the dd interface for a DD system
that is on the same host as the process. See class
dd for a detailed description of the member functions.
Comments:
- Exception handling:
If compiled with DD_NOEXCEPTION no exception will be thrown. Otherwise
the creation member function will throw an instance of the class
DD_Exception.
Modifications
- Added class Fifo_mode which encapsulates the mode of the fifo from the user.
CW, Nov 18, 98
- Add private member function setupCleanupScript that is used to setup the
cleanup script that will allow to clean up the IPC resources when the DD is
not deleted properly.
Creating and deleting DD systems
lDD( char* name, const char* mode, char* config_file, const char* dd_filename = pccDefaultDDFileName )
- creator w/o exception - called by DD::create_dd creator - called by DD::create_dd
~lDD()
- dtor
Coordination and control of the DD system
int flush( const int nMsec, const int brc_flush )
- flushing the system - see DD::flush
int wait4proc( const int nMsec )
- waiting for processes - see DD::wait4proc
int wakeup()
- wakeup sleeping processes - see DD::wakeup
int prepare_shutdown()
- inform processes about an imminet shutdown - see DD::prepare_shutdown
Member functions for FIFO manipulations
Fifo* create_fifo( const char* fifo_name, const char* type, Fifo_mode* mode, int slot_nb = -1)
- creates a fifo - see DD::create_fifo
int delete_fifo( const char* fifo_name = NULL)
- deletes a fifo - see DD::delete_fifo
inline Fifo_system* get_fifo_system()
- returns the Fifo_system - see DD::get_fifo_system
int fifo_exists( const char* fifoname ) const
- returns true if fifo exists - see DD::fifo_exists
int fifo_active( const char* fifoname ) const
- returns true if fifo is active - see DD::fif0_active
Inserting and accessing events in the pool
int req_fev( const int size, Fifo_entry &fev, const int req_mode = SLEEP, const int min_cnt = 1)
- request a new buffer - see DD::req_fev
int req_nfev( int &nEvents, const int size[], Fifo_entry fev[], const int req_mode = SLEEP, const int min_cnt = 1)
- request an arrat if new buffer - see DD::req_nfev
int ins_fev( Fifo_entry &fev )
- insert a new buffer - see DD::ins_fev
int rel_fev( Fifo_entry &fev )
- release an existing buffer - see DD::rel_fev
int get_fev( Fifo_entry &fev, const int mode, const char* fifo_name = NULL)
- get a buffer - see DD::get_fev
int get_nfev( int &nEvents, Fifo_entry fev[], const int mode, const char* fifo_name = NULL)
- get an array of buffer - see DD::get_nfev
int put_fev( Fifo_entry &fev, const char* fifo_name = NULL )
- put a buffer (obtained through get_fev) back into the DD - see DD::put_fev
int put_nfev( int &nEvents, Fifo_entry fev[], const char* fifo_name = NULL )
- put an array of buffer (obtained through get_nfev) back into the DD - see DD::put_fev
int brc_fev( Fifo_entry &fev, const int nMsec_wait)
- broadcast an buffer - see DD::brc_fev
int enable_events(const char* fifo_name = NULL)
- enable events in a fifo - see DD::enable_events
int disable_events(const char* fifo_name = NULL)
- disable events to a fifo - see DD::disable_events
Member functions to set/get process specific parameters
int set_brc( const int iBroadcast_mode )
- set broadcast mode - see DD::set_brc
int set_brccmd( int cmd, DD_BRCCMD_FCN brc_cmd_fcn )
- set broadcast commands - see DD::set_brccmd
int set_protection( Fifo::eFifo_protection protection )
- set fifo protection - see DD::set_protection
int set_reqcnt(const int req_cnt, const char* fifo_name)
- set request count - see DD::set_reqcnt
int set_prescale(const int prescale, const char* fifo_name)
- set prescale factor - see DD::set_prescale
inline Db* get_data_buffer()
- return pointer to the data buffer
inline dd_dcom_str* get_dcom_addr()
- return address of the registry
struct dd_config get_dd_config() const
- return structure describing the DD configuration - see DD::get_dd_config
int get_status() const
- return the status of the DD system - see DD::get_status
int sameEndianess()
- return -1 (0) if the Pool has the same endianess as the client. Note that on
a local pools this is always the case!
inline int get_ddpid() const
- return the DD pid of the process - see DD::get_ddpid
inline int get_ddmpid() const
- return the DD master id of the process - see DD::get_ddmpid
inline int get_nproc_att() const
- Return the number of processes that are currently attached to the system
int get_process_semcnt( int &nSem, int* &piSemcnt )
- return the semaphore counts of the DD - see DD::get_process_semcnt
int get_free_buffers( int &free_buffers ) const
- return the number of free buffers in the system - see DD::get_free_buffers
Static member functions tied to the signal handling
static void broadcast_received( int signum )
- signal handling routine when broadcast signal received
static void user_interrupt_received( int signum )
- signal handling routine when user interrupt received
static void shutdown_alert_received( int signum )
- signal handling routine when shutdown annoucement received
int dd_dcom_lock()
- Locking the DD system
int dd_dcom_unlock()
- Unlocking the DD system
int dd_dcom_add_master()
- Adding a new master.
- Returns:
- ddcSuccess if ok, ddcFailure if too many masters
void dd_dcom_rem_master()
- Removing a master
int dd_dcom_add_proc(const char* ccFifo_name = NULL)
- Register a new process to the system.
Note that this routine can be called more than once by a process
(e.g. when the process attaches to the system and then later
decides that it wants to create a fifo).
- Parameters:
- ccFifo_name - : the fifo from where the process gets events
- Returns:
- ddcSuccess if ok, ddcFailure if no more processes allowed.
int dd_dcom_rem_proc()
- Called to de-register the process from the DD system
int dd_dcom_set_procsem(int isem, int semval)
- Every process (and master too) reserves a semaphore by calling
dd_dcom_set_procsem from dd_dcom_add_proc. This semaphore
is created with UNDO mode, such that the OS removes it when the
process exists. The garbage demon monitors these semaphores and
tries to detect and remove processes that unexpectedly "disappeared".
void brc_lock()
- Locking routine to make sure that only one process broadcasts at a time
void brc_unlock()
- Broadcast unlocking routine
int brc_signal( Fifo_entry &fev, const int nMsec_wait )
- Member function that handles the signal broadcast. Called from DD::brc_fev
int brc_usmail( Fifo_entry &fev )
- Member function that handles the usmail broadcast. Called from DD::brc_fev
Fifo_entry create_volatile_buffer( const int size )
- Create an additional (volatile) buffer of size size (in longwords).
If we have more than dd_dcom->dd_config.db_max_buf_vol, then we wait a while
and try again - a maximum of eMax_vol_buf_tries times.
Note: default constrctor gives a "empty" fev
int delete_volatile_buffer( const int id )
- Deletes a volatile buffer previously allocated with create_volatile_buffer
static int create_static_user_fifos()
- Static fifos to be created at creation time.
Fifos come in two flavors: DYN fifos, that exist only
as long as there is at least one process attached to them.
STA fifos on the other hand are static in the sense that
they always exist, regardless whether they are in use or not.
This allows to make sure that certain fifos (and thus consumers)
receive events in a given, predetermined order (e.g. we first
write the events to tape and then pass them on to monitor processes).
create_static_user_fifos is called when the system is created to
allow creation of static fifos before any process attaches to the
DD system.
void read_configuration( char* my_conf_file )
- Read the DD configuration (max_fifo_nb, fifo_depth, db_maxnbev,
db_maxevsize, db_max_buf_nb) from a disk file and store them
in dcom. This is called when we create the DD system.
- Parameters:
- my_conf_file - : configuration file (see example in \$dd_data).
int check_configuration( char* my_conf_file )
- Reads the DD configuration parameters from the file config_file and
checks them agains the values in dcom.
In contrast to read_configuratio this routine is called if we
attach to an existing DD system (i.e. don't create it).
void link_signals()
- routine that links the signal when the DD system is created
void setupCleanupScript()
- Checks whether the environment variable DD_CLEANUP_SCRIPT is defined and if so
sets the IPC_CLEANUP_FILE variable that is used to create the ICP cleanup
script
void addGarbageDemonToCleanupScript( pid_t thePid ) const
- Adds a kill to the garbage demon into the cleanup script
psem* my_psem
- Pointer to DD system semaphore
pshm* my_dcom
- Pointer to DD shared memory registry
dd_dcom_str* dd_dcom
- Pointer to the registry itself (address where process is attached)
Fifo_system* fifos
- Pointer to the Fifo_system on top of which the DD works
Db* data_buffer
- Pointer to the data_buffer factory of the DD system
int iNb_broadcast_received
- Number of broadcasts that have been recieved
BOOL bBroadcast_received
- Flag that allows to find out whether a broadcast event has arrived
BOOL bUser_interrupt_received
- Flag that allows to find out whether we received a user interrupt
BOOL bShutdown
- Flag that allows to find out whether we received a shutdown alert message
- This class has no child classes.
- Friends:
- class DD_garbage_d
- Author:
- C.Witzig
Date: Dec 5, 98
- Version:
- Last update Nov 18, 98
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.