GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EMSG / V1-1-1 > emsg_st / rhel6-64
#include <stdlib.h>
#include <string.h>
#include <PBS/MBA.h>
#include <PBS/FPA.h>
#include <EMSG/EMSG_msgs.h>
#include <EMSG_prvdefs.h>
Functions | |
unsigned int | EMSG_countsSinceReset (EMSG_Counts *cnt, unsigned int rst) |
Return instrumentation counts since last reset. | |
unsigned int | EMSG_countsSinceStart (EMSG_Counts *cnt) |
Return instrumentation counts since message task started. | |
unsigned int | EMSG_initialize (const EMSG_InitPrm *prm) |
Initialize the message system. | |
unsigned int | EMSG_shutdown (void) |
Shut down the message system. | |
unsigned int | EMSG_startTask (int prio) |
Start the message task. | |
unsigned int | EMSG_stopTask (void) |
Stop the message task. | |
Variables | |
EMSG_Control * | EMSG_mcb = &mcb |
Pointer to the control block for the message system. | |
EMSG_AltMessage | EMSG_alt [EMSG_L_ALTERNATE] |
Translation table for the eight "special" messages. |
This file contains all the routines needed to initialize, start up, stop and shut down the error message system.
unsigned int EMSG_countsSinceReset | ( | EMSG_Counts * | cnt, | |
unsigned int | rst | |||
) |
Return instrumentation counts since last reset.
cnt | Counts block into which to put the results | |
rst | Reset flag (0 => don't reset, otherwise reset) |
EMSG_BADSTATE | Message system not initialized | |
EMSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
EMSG_S_UNINITIALIZED | n/a | EMSG_BADSTATE | All zero |
EMSG_S_INITIALIZED | no | EMSG_SUCCESS | Fake statistics for a zero length run of the msg task |
EMSG_S_INITIALIZED | yes | EMSG_SUCCESS | Statistics from most recent reset to time msg task stopped |
unsigned int EMSG_countsSinceStart | ( | EMSG_Counts * | cnt | ) |
Return instrumentation counts since message task started.
cnt | Counts block into which to put the results |
EMSG_BADSTATE | Message system not initialized | |
EMSG_SUCCESS | Success |
MSG state | MSG task has run at least once | Return code | Contents of instrumentation block |
EMSG_S_UNINITIALIZED | n/a | EMSG_BADSTATE | All zero |
EMSG_S_INITIALIZED | no | EMSG_SUCCESS | Fake statistics for a zero length run of the msg task |
EMSG_S_INITIALIZED | yes | EMSG_SUCCESS | Statistics for the most recent run of the msg task |
unsigned int EMSG_initialize | ( | const EMSG_InitPrm * | prm | ) |
Initialize the message system.
This routine initializes the message system according to the parameters provided in the parameterization block.
prm | (in) Parameter block contining initialization information (note 1) |
NULL
, EMSG_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 EMSG_InitPrm structure persistent.EMSG_ALOCFAIL | Fixed packet allocator (FPA) buffer allocation failed | |
EMSG_BADSTATE | Cannot initialize in the current MSG state | |
EMSG_FINDFAIL | Cannot look up up alternate messages in database | |
EMSG_FPAIFAIL | Fixed packet allocator (FPA) initialization failed | |
EMSG_MUALOCFL | Cannot allocate a mutex | |
EMSG_PKT2FEW | Packet count parameter too small | |
EMSG_PKT2SMAL | Packet length parameter too small | |
EMSG_SUCCESS | Success |
References _EMSG_Control::acb, _EMSG_Counts::beg, _EMSG_Control::beg, _EMSG_AltMessage::code, _EMSG_Counts::drop, _EMSG_Control::drp, EMSG_find(), EMSG_L_ALTERNATE, EMSG_MX_LOCK, EMSG_MX_UNLOCK, EMSG_P_RESERVED, EMSG_S_INITIALIZED, EMSG_S_UNINITIALIZED, _EMSG_Counts::end, _EMSG_Control::end, _EMSG_AltMessage::fdb, _EMSG_Counts::hwm, _EMSG_Counts::lwm, _EMSG_Counts::max, _EMSG_AltMessage::mdb, _EMSG_Control::mem, _EMSG_Control::now, _EMSG_Control::out, _EMSG_Control::pkt_cnt, _EMSG_InitPrm::pkt_cnt, _EMSG_Control::pkt_len, _EMSG_InitPrm::pkt_len, _EMSG_Control::reset, _EMSG_Counts::run, _EMSG_Control::save, _EMSG_Counts::sent, _EMSG_Control::start, _EMSG_Control::state, and _EMSG_Control::tOptn.
unsigned int EMSG_shutdown | ( | void | ) |
Shut down the message system.
This routine detaches all attached output processors and frees all resources associated with the message system.
EMSG_BADSTATE | Cannot shut down in the current state | |
EMSG_SUCCESS | Success |
References _EMSG_Control::acb, EMSG_MX_LOCK, EMSG_MX_UNLOCK, EMSG_S_INITIALIZED, EMSG_S_UNINITIALIZED, _EMSG_Control::mem, _EMSG_OutputRtn::next, _EMSG_Control::out, _EMSG_Control::save, _EMSG_Control::state, and _EMSG_Control::tOptn.
unsigned int EMSG_startTask | ( | int | prio | ) |
Start the message task.
In multi-threaded mode, this routine spawns a task (with the attributes defined in the task attributes block passed into this routine) to receive and process messages.
In single-threaded mode, it does not spawn a task, and all message processing is done inline with the report call. The task attributes block is ignored.
In both modes (and before the task spawn in multi-threaded mode), this routine calls each of the output processing routines in turn with a flag to indicate an inialization call.
prio | The priority of the message task in the multi-threaded case. If 0, the default value (200) is used. |
EMSG_BADSTATE | Cannot start in the current message state | |
EMSG_SPWNFAIL | Message task spawn failed | |
EMSG_SUCCESS | Success |
References _EMSG_Control::acb, _EMSG_Counts::beg, _EMSG_Control::beg, EMSG_MX_LOCK, EMSG_MX_UNLOCK, EMSG_OUT_EXIT, EMSG_OUT_INIT, EMSG_P_RESERVED, EMSG_S_INITIALIZED, EMSG_S_STARTED, _EMSG_Counts::end, _EMSG_Control::end, _EMSG_Counts::lwm, _EMSG_OutputRtn::next, _EMSG_Control::now, _EMSG_Control::out, _EMSG_Control::pkt_cnt, _EMSG_OutputRtn::prm, _EMSG_Control::reset, _EMSG_OutputRtn::rtn, _EMSG_Counts::run, _EMSG_Control::save, _EMSG_Control::start, and _EMSG_Control::state.
unsigned int EMSG_stopTask | ( | void | ) |
Stop the message task.
In multi-threaded mode, EMSG_stopTask() runs down the task spawned in EMSG_startTask() and releases the resources associated with it.
In single-threaded mode, there is no spawned task to run down.
In both modes (and after the spawned task has run down in multi- threaded mode), EMSG_stopTask() calls each of the output processing routines in turn with a flag to indicate a cleanup call.
EMSG_BADSTATE | Cannot stop in the current message state | |
EMSG_SUCCESS | Success |
References _EMSG_Control::acb, _EMSG_Control::beg, EMSG_MX_LOCK, EMSG_MX_UNLOCK, EMSG_OUT_EXIT, EMSG_S_INITIALIZED, EMSG_S_STARTED, EMSG_S_STOPPING, _EMSG_Counts::end, _EMSG_Control::end, _EMSG_OutputRtn::next, _EMSG_Control::now, _EMSG_Control::out, _EMSG_Control::pkt_cnt, _EMSG_OutputRtn::prm, _EMSG_Control::reset, _EMSG_OutputRtn::rtn, _EMSG_Counts::run, _EMSG_Control::save, _EMSG_Control::start, and _EMSG_Control::state.
EMSG_AltMessage EMSG_alt[EMSG_L_ALTERNATE] |
Initial value:
{ { EMSG_UNKNOWNS, NULL, NULL }, { EMSG_UNKNOWNW, NULL, NULL }, { EMSG_UNKNOWNI, NULL, NULL }, { EMSG_UNKNOWNE, NULL, NULL }, { EMSG_UNIXGOOD, NULL, NULL }, { EMSG_UNIXEROR, NULL, NULL }, { EMSG_GAPBEGIN, NULL, NULL }, { EMSG_GAPEND, NULL, NULL } }
Referenced by EMSG_outputScan(), and EMSG_report().
EMSG_Control* EMSG_mcb = &mcb |
Pointer to the control block for the message system.
Referenced by EMSG_attachOutputRtn(), EMSG_detachOutputRtn(), EMSG_outputScan(), and EMSG_report().