class lDD

Class for a local (same host) DD system.

Inheritance:


Public Methods

[more] Creating and deleting DD systems
[more] Coordination and control of the DD system
[more] Member functions for FIFO manipulations
[more] Inserting and accessing events in the pool
[more] Member functions to set/get process specific parameters
[more] Static member functions tied to the signal handling


Inherited from DD:

Public Fields

ostatic const char* const pccDefaultDDName
ostatic const char* const pccDefaultDDFileName

Public Methods

Miscellanous member functions

ostatic void printUnsupportedOperation( const char* operation )

Public Members

enums as static data members

Protected Fields

oBOOL is_local
ochar* name
ochar* config_file
ochar* dd_filename
ostatic 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:

Modifications

o Creating and deleting DD systems

o 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

o ~lDD()
dtor

o Coordination and control of the DD system

oint flush( const int nMsec, const int brc_flush )
flushing the system - see DD::flush

oint wait4proc( const int nMsec )
waiting for processes - see DD::wait4proc

oint wakeup()
wakeup sleeping processes - see DD::wakeup

oint prepare_shutdown()
inform processes about an imminet shutdown - see DD::prepare_shutdown

o Member functions for FIFO manipulations

oFifo* create_fifo( const char* fifo_name, const char* type, Fifo_mode* mode, int slot_nb = -1)
creates a fifo - see DD::create_fifo

oint delete_fifo( const char* fifo_name = NULL)
deletes a fifo - see DD::delete_fifo

oinline Fifo_system* get_fifo_system()
returns the Fifo_system - see DD::get_fifo_system

oint fifo_exists( const char* fifoname ) const
returns true if fifo exists - see DD::fifo_exists

oint fifo_active( const char* fifoname ) const
returns true if fifo is active - see DD::fif0_active

o Inserting and accessing events in the pool

oint 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

oint 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

oint ins_fev( Fifo_entry &fev )
insert a new buffer - see DD::ins_fev

oint rel_fev( Fifo_entry &fev )
release an existing buffer - see DD::rel_fev

oint get_fev( Fifo_entry &fev, const int mode, const char* fifo_name = NULL)
get a buffer - see DD::get_fev

oint get_nfev( int &nEvents, Fifo_entry fev[], const int mode, const char* fifo_name = NULL)
get an array of buffer - see DD::get_nfev

oint 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

oint 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

oint brc_fev( Fifo_entry &fev, const int nMsec_wait)
broadcast an buffer - see DD::brc_fev

oint enable_events(const char* fifo_name = NULL)
enable events in a fifo - see DD::enable_events

oint disable_events(const char* fifo_name = NULL)
disable events to a fifo - see DD::disable_events

o Member functions to set/get process specific parameters

oint set_brc( const int iBroadcast_mode )
set broadcast mode - see DD::set_brc

oint set_brccmd( int cmd, DD_BRCCMD_FCN brc_cmd_fcn )
set broadcast commands - see DD::set_brccmd

oint set_protection( Fifo::eFifo_protection protection )
set fifo protection - see DD::set_protection

oint set_reqcnt(const int req_cnt, const char* fifo_name)
set request count - see DD::set_reqcnt

oint set_prescale(const int prescale, const char* fifo_name)
set prescale factor - see DD::set_prescale

oinline Db* get_data_buffer()
return pointer to the data buffer

oinline dd_dcom_str* get_dcom_addr()
return address of the registry

ostruct dd_config get_dd_config() const
return structure describing the DD configuration - see DD::get_dd_config

oint get_status() const
return the status of the DD system - see DD::get_status

oint 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!

oinline int get_ddpid() const
return the DD pid of the process - see DD::get_ddpid

oinline int get_ddmpid() const
return the DD master id of the process - see DD::get_ddmpid

oinline int get_nproc_att() const
Return the number of processes that are currently attached to the system

oint get_process_semcnt( int &nSem, int* &piSemcnt )
return the semaphore counts of the DD - see DD::get_process_semcnt

oint get_free_buffers( int &free_buffers ) const
return the number of free buffers in the system - see DD::get_free_buffers

o Static member functions tied to the signal handling

ostatic void broadcast_received( int signum )
signal handling routine when broadcast signal received

ostatic void user_interrupt_received( int signum )
signal handling routine when user interrupt received

ostatic void shutdown_alert_received( int signum )
signal handling routine when shutdown annoucement received

oint dd_dcom_lock()
Locking the DD system

oint dd_dcom_unlock()
Unlocking the DD system

oint dd_dcom_add_master()
Adding a new master.
Returns:
ddcSuccess if ok, ddcFailure if too many masters

ovoid dd_dcom_rem_master()
Removing a master

oint 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.

oint dd_dcom_rem_proc()
Called to de-register the process from the DD system

oint 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".

ovoid brc_lock()
Locking routine to make sure that only one process broadcasts at a time

ovoid brc_unlock()
Broadcast unlocking routine

oint brc_signal( Fifo_entry &fev, const int nMsec_wait )
Member function that handles the signal broadcast. Called from DD::brc_fev

oint brc_usmail( Fifo_entry &fev )
Member function that handles the usmail broadcast. Called from DD::brc_fev

oFifo_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

oint delete_volatile_buffer( const int id )
Deletes a volatile buffer previously allocated with create_volatile_buffer

ostatic 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.

ovoid 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).

oint 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).

ovoid link_signals()
routine that links the signal when the DD system is created

ovoid 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

ovoid addGarbageDemonToCleanupScript( pid_t thePid ) const
Adds a kill to the garbage demon into the cleanup script

opsem* my_psem
Pointer to DD system semaphore

opshm* my_dcom
Pointer to DD shared memory registry

odd_dcom_str* dd_dcom
Pointer to the registry itself (address where process is attached)

oFifo_system* fifos
Pointer to the Fifo_system on top of which the DD works

oDb* data_buffer
Pointer to the data_buffer factory of the DD system

oint iNb_broadcast_received
Number of broadcasts that have been recieved

oBOOL bBroadcast_received
Flag that allows to find out whether a broadcast event has arrived

oBOOL bUser_interrupt_received
Flag that allows to find out whether we received a user interrupt

oBOOL 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++.