GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MSG / V3-1-2 > msg_st / rhel6-32
#include <stdlib.h>
#include <string.h>
#include <PBS/MBA.h>
#include <PBS/TASK.h>
#include <PBS/WCT.h>
#include <MDB/MDB_pubdefs.h>
#include <MSG/MSG_msgs.h>
#include <MSG_health.h>
#include <MSG_prvdefs.h>
Functions | |
static unsigned int | countsSince (MSG_Counts *cnt, unsigned int sel, unsigned int rst) |
Worker bee for MSG_countsSinceStart() and MSG_countsSinceReset(). | |
unsigned int | MSG_countsSinceReset (MSG_Counts *cnt, unsigned int rst) |
Return instrumentation counts since last reset. | |
unsigned int | MSG_countsSinceStart (MSG_Counts *cnt) |
Return instrumentation counts since message task started. | |
unsigned int | MSG_getCtlThread () |
Return the threading model. | |
unsigned int | MSG_initialize (const MSG_InitPrm *prm) |
Take message system from state MSG_S_UNINITIALIZED to state MSG_S_INITIALIZED. | |
void | MSG_setCPU (unsigned int cpu) |
Set the CPU identifier word. | |
unsigned int | MSG_shutdown () |
Take message system from state MSG_S_INITIALIZED to state MSG_S_UNINITIALIZED. | |
unsigned int | MSG_startTask (const TASK_attr *attr) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_STARTED. | |
unsigned int | MSG_stopTask () |
Take message system from state MSG_S_STARTED to state MSG_S_INITIALIZED. | |
Variables | |
static const unsigned int | threaded = 1 |
Carry knowledge of the threading model into the run time environment. | |
MSG_Control * | MSG_mcb |
Pointer to message control block structure. | |
MSG_AltMessage | MSG_alt [MSG_L_ALTERNATE] |
Translation table for the eight "special" messages. |
CVS $Id: MSG_control.c,v 1.14 2011/03/25 01:05:53 apw Exp $
unsigned int countsSince | ( | MSG_Counts * | cnt, | |
unsigned int | sel, | |||
unsigned int | rst | |||
) | [static] |
Worker bee for MSG_countsSinceStart() and MSG_countsSinceReset().
cnt | MSG_Counts block into which to put the results | |
sel | Selector (0/1 => since start/since reset) | |
rst | Reset flag (0/1 => no reset/reset) |
MSG_BADSTATE | ||
MSG_SUCCESS | countsSince() is the worker bee for the MSG_countsSinceStart() and MSG_countsSinceReset() routines. |
References _MSG_Counts::beg, _MSG_Counts::drop, _MSG_Counts::end, _MSG_Counts::hwm, _MSG_Counts::lwm, MSG_RW_DECLARE, MSG_RW_LOCK, MSG_RW_UNLOCK, _MSG_Control::now, _MSG_Control::reset, _MSG_Counts::run, _MSG_Control::rwi, _MSG_Counts::sent, and _MSG_Control::start.
Referenced by MSG_countsSinceReset(), and MSG_countsSinceStart().
unsigned int MSG_countsSinceReset | ( | MSG_Counts * | cnt, | |
unsigned int | rst | |||
) |
Return instrumentation counts since last reset.
cnt | MSG_Counts block into which to put the results | |
rst | Reset flag (0 => don't reset, otherwise reset) |
MSG_BADSTATE | Message system not initialized | |
MSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
MSG_S_UNINITIALIZED | n/a | MSG_BADSTATE | All zero |
MSG_S_INITIALIZED | no | MSG_SUCCESS | Fake statistics for a zero length run of the MSG task |
MSG_S_INITIALIZED | yes | MSG_SUCCESS | Statistics from most recent reset to time MSG task stopped |
References countsSince().
unsigned int MSG_countsSinceStart | ( | MSG_Counts * | cnt | ) |
Return instrumentation counts since message task started.
cnt | MSG_Counts block into which to put the results |
MSG_BADSTATE | Message system not initialized | |
MSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
MSG_S_UNINITIALIZED | n/a | MSG_BADSTATE | All zero |
MSG_S_INITIALIZED | no | MSG_SUCCESS | Fake statistics for a zero length run of the MSG task |
MSG_S_INITIALIZED | yes | MSG_SUCCESS | Statistics for the most recent run of the MSG task |
References countsSince().
unsigned int MSG_getCtlThread | ( | void | ) |
Return the threading model.
0 | Single-threaded | |
1 | Multi-threaded |
unsigned int MSG_initialize | ( | const MSG_InitPrm * | prm | ) |
Take message system from state MSG_S_UNINITIALIZED to state MSG_S_INITIALIZED.
prm | (in) Parameter block contining initialization information (note 1) |
NULL
, MSG_initialize() will provide a default (currently 32 message packets of 256 bytes each). If prm is not NULL
, the caller need not make the storage for the MSG_InitPrm structure persistent.MSG_ALOCFAIL | Fixed packet allocator (FPA) buffer allocation failed | |
MSG_BADSTATE | Cannot initialize in the current MSG state | |
MSG_FINDFAIL | Cannot look up up alternate messages in database | |
MSG_FPAIFAIL | Fixed packet allocator (FPA) initialization failed | |
MSG_MUALOCFL | Cannot allocate a mutex | |
MSG_PKT2FEW | Packet count parameter too small | |
MSG_PKT2SMAL | Packet length parameter too small | |
MSG_SUCCESS | Success |
References _MSG_Control::acb, _MSG_Counts::beg, _MSG_Control::beg, _MSG_AltMessage::code, _MSG_Control::cpu, _MSG_Counts::drop, _MSG_Control::drp, _MSG_Counts::end, _MSG_Control::end, _MSG_Control::fcb, _MSG_AltMessage::fdb, _MSG_Control::fqi, _MSG_Counts::hwm, _MSG_Counts::lwm, _MSG_Counts::max, _MSG_AltMessage::mdb, _MSG_Control::mem, MSG_alt, MSG_L_ALTERNATE, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_P_RESERVED, MSG_reportInternal(), MSG_RW_DECLARE, MSG_S_INITIALIZED, MSG_S_UNINITIALIZED, _MSG_Control::mtx, _MSG_Control::now, _MSG_Control::out, _MSG_Control::pad, _MSG_Control::pkt_cnt, _MSG_InitPrm::pkt_cnt, _MSG_Control::pkt_len, _MSG_InitPrm::pkt_len, _MSG_Control::reset, _MSG_Counts::run, _MSG_Control::rwi, _MSG_Control::save, _MSG_Counts::sent, _MSG_Control::start, and _MSG_Control::state.
Referenced by MSG_configure().
void MSG_setCPU | ( | unsigned int | cpu | ) |
Set the CPU identifier word.
cpu | (in) CPU identifier |
References _MSG_Control::cpu.
Referenced by MSG_configure().
unsigned int MSG_shutdown | ( | void | ) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_UNINITIALIZED.
MSG_BADSTATE | Cannot shut down in the current MSG state | |
MSG_SUCCESS | Success |
References _MSG_Control::acb, _MSG_Control::fcb, _MSG_Control::mem, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_S_INITIALIZED, MSG_S_UNINITIALIZED, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::out, _MSG_Control::save, and _MSG_Control::state.
unsigned int MSG_startTask | ( | const TASK_attr * | attr | ) |
Take message system from state MSG_S_INITIALIZED to state MSG_S_STARTED.
attr | (in) Task attributes block containing task start-up information (note 1) |
NULL
, MSG_startTask() will provide a default. If attr is not NULL
, the caller need not make the storage for the TASK_attr structure persistent.MSG_BADSTATE | Cannot start in the current MSG state | |
MSG_FORKFAIL | FORK initialization failed | |
MSG_FPAGFAIL | Fixed packet allocator get failed during task start | |
MSG_SUCCESS | Success |
In single-threaded mode, MSG_startTask() does not fork a task, and all message processing is done inline with the MSG_report() call. The task attributes block is ignored.
In both modes (and before the task fork in multi-threaded mode), MSG_startTask() calls each of the output processing routines in turn with a flag to indicate an inialization call.
References _MSG_Control::acb, _MSG_Control::beg, _MSG_Control::end, _MSG_Control::fcb, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_OUT_EXIT, MSG_OUT_INIT, MSG_outputScan(), MSG_P_RESERVED, MSG_S_INITIALIZED, MSG_S_STARTED, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::out, _MSG_OutputRtn::prm, _MSG_OutputRtn::rtn, _MSG_Control::save, and _MSG_Control::state.
Referenced by MSG_configure().
unsigned int MSG_stopTask | ( | void | ) |
Take message system from state MSG_S_STARTED to state MSG_S_INITIALIZED.
MSG_BADSTATE | Cannot stop in the current MSG state | |
MSG_SUCCESS | Success |
In single-threaded mode, there is no forked task to run down.
In both modes (and after the forked task has run down in multi-threaded mode), MSG_stopTask() calls each of the output processing routines in turn with a flag to indicate a cleanup call.
References _MSG_Control::acb, _MSG_Control::beg, _MSG_Counts::end, _MSG_Control::end, _MSG_Control::fcb, _MSG_Control::fqi, MSG_MX_LOCK, MSG_MX_UNLOCK, MSG_OUT_EXIT, MSG_S_INITIALIZED, MSG_S_STARTED, MSG_S_STOPPING, _MSG_Control::mtx, _MSG_OutputRtn::next, _MSG_Control::now, _MSG_Control::out, _MSG_Control::pkt_cnt, _MSG_OutputRtn::prm, _MSG_Control::reset, _MSG_OutputRtn::rtn, _MSG_Counts::run, _MSG_Control::save, _MSG_Control::start, and _MSG_Control::state.
MSG_AltMessage MSG_alt[MSG_L_ALTERNATE] |
Initial value:
{ { MSG_UNKNOWNS, NULL, NULL }, { MSG_UNKNOWNW, NULL, NULL }, { MSG_UNKNOWNI, NULL, NULL }, { MSG_UNKNOWNE, NULL, NULL }, { MSG_UNIXGOOD, NULL, NULL }, { MSG_UNIXEROR, NULL, NULL }, { MSG_GAPBEGIN, NULL, NULL }, { MSG_GAPEND, NULL, NULL } }
Small database to make the substitution of alternative messages more efficient. The NULLs are replaced during the initialization phase (once only).
Referenced by MSG_initialize(), MSG_outputScan(), and MSG_reportInternal().
Pointer to message control block structure.
Pointer to the control block for the message system.
Referenced by MSG_attachOutputRtn(), MSG_detachOutputRtn(), MSG_outputScan(), MSG_reportInternal(), and reportCapture().
static const unsigned int threaded = 1 [static] |
Carry knowledge of the threading model into the run time environment.
Used mainly for testing purposes.