PUBLIC: struct MqErrorS
[PUBLIC: struct MqLinkS]

the MqErrorS API is used to manage error messages. More...

Collaboration diagram for PUBLIC: struct MqErrorS:

Defines

#define MQ_ERROR_PANIC   ((struct MqS*)NULL)
 panic on error
#define MQ_ERROR_IGNORE   ((struct MqS*)0x1)
 ignore error and do not generate any error-text (don't fill the error object)
#define MQ_ERROR_PRINT   ((struct MqS*)0x2)
 print error to stderr
#define MQ_ERROR_IS_POINTER(e)   (e>MQ_ERROR_PRINT)
#define MqPanicC(context, prefix, errnum, string)   MqPanicV(context,prefix,errnum,"%s",string);
 do a panic with string as argument
#define MqPanicSYS(context)
 do a panic with a system error message
#define MqErrorV(error, prefix, errnum, format,...)   MqErrorSGenV(error,prefix,MQ_ERROR,errnum,format, __VA_ARGS__)
 customized edition of MqErrorSGenV
#define MqErrorSAppendC(error, str)   MqErrorSAppendV(error,"%s",str);
 append a string to a MqErrorS
#define MqErrorStack(error)   MqErrorStackP(error, __func__, __FILE__)
 convenience wrapper for MqErrorStackP
#define MqErrorCheckI(PROC)   (unlikely((PROC) >= MQ_ERROR))
 check on error
#define MqErrorCheck(PROC)   if (MqErrorCheckI(PROC)) goto error
 version of MqErrorCheckI
#define MqErrorSwitch(PROC)
 process error message
#define MqErrorReturn(PROC)
 process error message
#define MqErrorCheck1(PROC)   if (MqErrorCheckI(PROC)) goto error1
 check on error and goto label error1
#define MqErrorCheck2(PROC, JUMP)   if (MqErrorCheckI(PROC)) goto JUMP
 check on error and goto label JUMP

Enumerations

enum  MqErrorE { MQ_OK = 0, MQ_CONTINUE = 1, MQ_ERROR = 2, MQ_EXIT = 3 }
 collection for the different error-codes More...

Functions

MQ_EXTERN void MqPanicVL (struct MqS *const context, MQ_CST const prefix, MQ_INT const errnum, MQ_CST const fmt, va_list var_list)
 do a panic with a vararg argument list
MQ_EXTERN void MqPanicV (struct MqS *const context, MQ_CST const prefix, MQ_INT const errnum, MQ_CST const fmt,...)
 do a panic with vararg arguments
MQ_EXTERN void MqErrorReset (struct MqS *const context)
 reset a MqErrorS object, change error code to MQ_OK
MQ_EXTERN enum MqErrorE MqErrorSGenVL (struct MqS *const context, MQ_CST const prefix, enum MqErrorE const errorcode, MQ_INT const errnum, MQ_CST const fmt, va_list var_list)
 set an error-code in MqErrorS with vararg list argument
MQ_EXTERN enum MqErrorE MqErrorSGenV (struct MqS *const context, MQ_CST const prefix, enum MqErrorE const errorcode, MQ_INT const errnum, MQ_CST const fmt,...)
 set a error-code in MqErrorS with vararg string argument
MQ_EXTERN enum MqErrorE MqErrorC (struct MqS *const context, MQ_CST const prefix, MQ_INT const errnum, MQ_CST const message)
 customized edition of MqErrorSGenV
MQ_EXTERN enum MqErrorE MqErrorSAppendV (struct MqS const *const context, MQ_CST const fmt,...)
 append a vararg string to a MqErrorS
MQ_EXTERN enum MqErrorE MqErrorStackP (struct MqS *const context, MQ_CST const func, MQ_CST const file)
 append a function and filename to the error-buffer
MQ_EXTERN enum MqErrorE MqErrorGetCode (struct MqS const *const context)
 return the value of MqErrorS code member
MQ_EXTERN enum MqErrorE MqErrorSetCode (struct MqS *const context, enum MqErrorE code)
 set the value of MqErrorS code member
MQ_EXTERN MQ_CST MqErrorGetText (struct MqS const *const context)
 return the value of MqErrorS text member
MQ_EXTERN void MqErrorPrint (struct MqS *const context)
 return the value of MqErrorS num member
MQ_EXTERN MQ_INT MqErrorGetNum (struct MqS const *const context)
 brint an error to stderr and clear the error after
MQ_EXTERN enum MqErrorE MqErrorSet (struct MqS *const context, int num, enum MqErrorE code, MQ_CST const message)
 set the value of the MqErrorS object
MQ_EXTERN void MqErrorLog (struct MqS const *const context, MQ_CST const prefix)
 log the MqErrorS for debugging
MQ_EXTERN enum MqErrorE MqErrorCopy (struct MqS *const out, struct MqS *const in)
 copy a MqErrorS from in to out

Detailed Description

the MqErrorS API is used to manage error messages.

the management is done with a MqErrorS object created by MgCreate. every MqS object has only one MqErrorS object and every MqErrorS object has only one MqS object. the MqErrorS object is used to collect all data needed to handle an error.


Define Documentation

#define MQ_ERROR_IGNORE   ((struct MqS*)0x1)

ignore error and do not generate any error-text (don't fill the error object)

This item is used as special meaning for the struct MqErrorS argument of error-functions

Definition at line 2620 of file msgque.h.

Referenced by GenericDelete(), MqErrorSAppendV(), MqErrorSGenV(), MqErrorSGenVL(), MqPanicV(), MqPanicVL(), pIoDelete(), sSysMqErrorMsg(), and SysSocketPair().

#define MQ_ERROR_IS_POINTER (  )     (e>MQ_ERROR_PRINT)

Definition at line 2628 of file msgque.h.

Referenced by MqDLogX(), MqErrorSGenV(), MqErrorStackP(), pErrorReport(), pMqShutdown(), and sLogVL().

#define MQ_ERROR_PANIC   ((struct MqS*)NULL)

#define MQ_ERROR_PRINT   ((struct MqS*)0x2)

print error to stderr

This item is used as special meaning for the struct MqErrorS argument of error-functions

Definition at line 2626 of file msgque.h.

Referenced by MqErrorSGenVL().

#define MqErrorCheck ( PROC   )     if (MqErrorCheckI(PROC)) goto error

#define MqErrorCheck1 ( PROC   )     if (MqErrorCheckI(PROC)) goto error1

check on error and goto label error1

Definition at line 2846 of file msgque.h.

Referenced by MqSlaveWorker(), pTokenCheckSystem(), pTransSetResult(), and SysServerFork().

#define MqErrorCheck2 ( PROC,
JUMP   )     if (MqErrorCheckI(PROC)) goto JUMP

check on error and goto label JUMP

Definition at line 2848 of file msgque.h.

#define MqErrorCheckI ( PROC   )     (unlikely((PROC) >= MQ_ERROR))

check on error

Returns:
MQ_OK and MQ_CONTINUE are good statues and MQ_ERROR and MQ_EXIT are bad statues

Definition at line 2834 of file msgque.h.

Referenced by MqErrorStackP(), MqLinkCreate(), MqReadProxy(), pSlaveCreate(), and pTokenCheckSystem().

#define MqErrorReturn ( PROC   ) 

Value:

switch (PROC) {\
case MQ_OK: return MQ_OK; case MQ_CONTINUE: return MQ_CONTINUE; case MQ_EXIT: case MQ_ERROR: return MqErrorStack (MQ_CONTEXT_S);\
}; return MQ_OK;
process error message

Definition at line 2842 of file msgque.h.

Referenced by MqSendEND_AND_CALLBACK(), MqSendEOF(), MqSendFTR(), pIoRead(), pIoSelect(), pIoSend(), pMqSendEND(), and pSendSYSTEM_RETR().

#define MqErrorSAppendC ( error,
str   )     MqErrorSAppendV(error,"%s",str);

append a string to a MqErrorS

Definition at line 2752 of file msgque.h.

#define MqErrorStack ( error   )     MqErrorStackP(error, __func__, __FILE__)

#define MqErrorSwitch ( PROC   ) 

Value:

switch (PROC) {\
case MQ_OK: break; case MQ_ERROR: goto error; case MQ_EXIT: return MQ_EXIT; case MQ_CONTINUE: return MQ_CONTINUE;\
}
process error message

Definition at line 2838 of file msgque.h.

Referenced by pReadHDR(), pWaitForToken(), and sReadFIX().

#define MqErrorV ( error,
prefix,
errnum,
format,
...   )     MqErrorSGenV(error,prefix,MQ_ERROR,errnum,format, __VA_ARGS__)

#define MqPanicC ( context,
prefix,
errnum,
string   )     MqPanicV(context,prefix,errnum,"%s",string);

do a panic with string as argument

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errnum the error number
string the string to be displayed
Attention:
this function will never return

Definition at line 2665 of file msgque.h.

Referenced by MqSendEND_AND_WAIT(), sEventCreate(), and sLogDynItem().

#define MqPanicSYS ( context   ) 

Value:

MqPanicV(context,__func__,-1,\
        "internal ERROR in function '%s', please contact your local support", __func__);
do a panic with a system error message

Parameters:
[in] context the initial MqS object created by MqContextCreate
Attention:
this function will never return

Definition at line 2670 of file msgque.h.

Referenced by MqExit(), MqSendRETURN(), MqSendU(), and pEventStart().


Enumeration Type Documentation

enum MqErrorE

collection for the different error-codes

Enumerator:
MQ_OK  everything is OK, no error available (persistent)
MQ_CONTINUE  continue with upper code
MQ_ERROR  exit upper code with an error (persistent)
MQ_EXIT  exit parent context

Definition at line 359 of file msgque.h.


Function Documentation

MQ_EXTERN enum MqErrorE MqErrorC ( struct MqS *const   context,
MQ_CST const   prefix,
MQ_INT const   errnum,
MQ_CST const   message 
)

customized edition of MqErrorSGenV

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errnum the error number
[in] message string message to set
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 191 of file error.c.

References MQ_ERROR, and MqErrorSGenV().

Referenced by MqConfigSetIoUds(), MqSendEND_AND_WAIT(), MqSysCalloc(), MqSysMalloc(), and MqSysRealloc().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorCopy ( struct MqS *const   out,
struct MqS *const   in 
)

copy a MqErrorS from in to out

Parameters:
out the MqS::error object created by MqLinkCreate
in the MqS::error object created by MqLinkCreate

Definition at line 376 of file error.c.

References MqErrorS::code, MqS::error, MQ_OK, MqErrorReset(), and pErrorSync().

Referenced by MqExit(), MqLinkCreate(), MqPanicVL(), MqReadProxy(), MqSlaveWorker(), pCallFactory(), pEventStart(), pSlaveCreate(), pTokenCheckSystem(), sDefaultFactory(), and sMqEventStart().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorGetCode ( struct MqS const *const   context  ) 

return the value of MqErrorS code member

Parameters:
[in] context the initial MqS object created by MqContextCreate

Definition at line 273 of file error.c.

References MqErrorS::code, and MqS::error.

Referenced by MqCheckForLeftOverArguments(), MqLinkCreate(), MqReadProxy(), MqSendRETURN(), pCallFactory(), pEventStart(), and sDefaultFactory().

Here is the caller graph for this function:

MQ_EXTERN MQ_INT MqErrorGetNum ( struct MqS const *const   context  ) 

brint an error to stderr and clear the error after

Parameters:
[in] context the initial MqS object created by MqContextCreate

Definition at line 311 of file error.c.

References MqS::error, and MqErrorS::num.

Referenced by MqExit(), MqSendERROR(), and MqSendRETURN().

Here is the caller graph for this function:

MQ_EXTERN MQ_CST MqErrorGetText ( struct MqS const *const   context  ) 

return the value of MqErrorS text member

Parameters:
[in] context the initial MqS object created by MqContextCreate

Definition at line 290 of file error.c.

References MqBufferS::data, MqS::error, and MqErrorS::text.

Referenced by MqSendERROR(), and MqSendRETURN().

Here is the caller graph for this function:

MQ_EXTERN void MqErrorLog ( struct MqS const *const   context,
MQ_CST const   prefix 
)

log the MqErrorS for debugging

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment

MQ_EXTERN void MqErrorPrint ( struct MqS *const   context  ) 

return the value of MqErrorS num member

Definition at line 319 of file error.c.

References MqBufferS::data, MqS::error, MqErrorReset(), and MqErrorS::text.

MQ_EXTERN void MqErrorReset ( struct MqS *const   context  ) 

reset a MqErrorS object, change error code to MQ_OK

Parameters:
[in] context the initial MqS object created by MqContextCreate

Definition at line 298 of file error.c.

References MqErrorS::append, MqErrorS::code, MqS::error, MQ_OK, MQ_YES, MqBufferReset(), MqErrorS::num, and MqErrorS::text.

Referenced by MqErrorCopy(), MqErrorPrint(), MqLinkCreate(), MqSendERROR(), MqSendRETURN(), MqSlaveDelete(), pErrorReport(), pMqShutdown(), pSlaveBqError(), pTokenInvoke(), and sEventAlloc().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorSAppendV ( struct MqS const *const   context,
MQ_CST const   fmt,
  ... 
)

append a vararg string to a MqErrorS

Parameters:
[in] context the initial MqS object created by MqContextCreate
fmt a printf like format string
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 223 of file error.c.

References MqErrorS::append, MqErrorS::code, MqS::config, MqS::error, MqConfigS::master, MQ_ERROR, MQ_ERROR_IGNORE, MQ_IS_CHILD, MQ_IS_SERVER, MqBufferAppendV(), MqBufferAppendVL(), MqDLogEVL(), MqLog(), MqConfigS::name, and MqErrorS::text.

Referenced by MqCheckForLeftOverArguments(), MqErrorStackP(), MqPanicVL(), and pReadHDR().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorSet ( struct MqS *const   context,
int  num,
enum MqErrorE  code,
MQ_CST const   message 
)

set the value of the MqErrorS object

Parameters:
[in] context the initial MqS object created by MqContextCreate
[in] num the error number to set
[in] code the error code to set
[in] message the error message to set
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 330 of file error.c.

References MqErrorS::append, MqErrorS::code, MqS::config, MqS::error, MqConfigS::master, MQ_YES, MqBufferSetC(), MqErrorS::num, pErrorSync(), and MqErrorS::text.

Referenced by pTokenCheckSystem().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorSetCode ( struct MqS *const   context,
enum MqErrorE  code 
)

set the value of MqErrorS code member

Parameters:
[in] context the initial MqS object created by MqContextCreate
code the code to set for error

Definition at line 281 of file error.c.

References MqErrorS::code, and MqS::error.

MQ_EXTERN enum MqErrorE MqErrorSGenV ( struct MqS *const   context,
MQ_CST const   prefix,
enum MqErrorE const   errorcode,
MQ_INT const   errnum,
MQ_CST const   fmt,
  ... 
)

set a error-code in MqErrorS with vararg string argument

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errorcode identify the code
errnum the error number
fmt a printf like format string
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 171 of file error.c.

References MqErrorS::code, MqS::error, MQ_ERROR_IGNORE, MQ_ERROR_IS_POINTER, MQ_EXIT, and MqErrorSGenVL().

Referenced by MqErrorC(), and pErrorSetEXIT().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorSGenVL ( struct MqS *const   context,
MQ_CST const   prefix,
enum MqErrorE const   errorcode,
MQ_INT const   errnum,
MQ_CST const   fmt,
va_list  var_list 
)

set an error-code in MqErrorS with vararg list argument

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errorcode identify the code
errnum the error number
fmt a printf like format string
var_list a variable argument list object
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 124 of file error.c.

References MqErrorS::code, MqS::config, MqBufferS::data, MqS::error, MqConfigS::master, MQ_ERROR, MQ_ERROR_IGNORE, MQ_ERROR_PANIC, MQ_ERROR_PRINT, MQ_FORMAT_I, MQ_IS_CHILD, MQ_IS_SERVER, MqBufferAppendV(), MqBufferAppendVL(), MqBufferCreate(), MqBufferDelete(), MqBufferReset(), MqBufferSetV(), MqDLogEVL(), MqPanicVL(), MqConfigS::name, MqErrorS::num, pErrorSync(), and MqErrorS::text.

Referenced by MqErrorSGenV(), and MqPanicVL().

Here is the caller graph for this function:

MQ_EXTERN enum MqErrorE MqErrorStackP ( struct MqS *const   context,
MQ_CST const   func,
MQ_CST const   file 
)

append a function and filename to the error-buffer

Parameters:
[in] context the initial MqS object created by MqContextCreate
func the name of the function to display (e.g. __func__)
file the name of the file to display (e.g. __FILE__)
Returns:
the MqErrorE return status MQ_OK, MQ_ERROR or MQ_CONTINUE

Definition at line 203 of file error.c.

References MqErrorS::code, MqS::error, MQ_ERROR, MQ_ERROR_IS_POINTER, MQ_YES, MqDLogX(), MqErrorCheckI, MqErrorSAppendV(), MqLogErrorCode(), and MqSysBasename().

MQ_EXTERN void MqPanicV ( struct MqS *const   context,
MQ_CST const   prefix,
MQ_INT const   errnum,
MQ_CST const   fmt,
  ... 
)

do a panic with vararg arguments

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errnum the error number
fmt a printf like format string
Attention:
this function will never return

Definition at line 84 of file error.c.

References MQ_ERROR_IGNORE, and MqPanicVL().

Referenced by MqBufferAppendVL().

Here is the caller graph for this function:

MQ_EXTERN void MqPanicVL ( struct MqS *const   context,
MQ_CST const   prefix,
MQ_INT const   errnum,
MQ_CST const   fmt,
va_list  var_list 
)

do a panic with a vararg argument list

Parameters:
[in] context the initial MqS object created by MqContextCreate
prefix used to identify the calling function (e.g. __func__) or the environment
errnum the error number
fmt a printf like format string
var_list a variable argument list object
Attention:
this function will never return

Definition at line 58 of file error.c.

References MqBufferU::C, MqBufferS::cur, MQ_ERROR, MQ_ERROR_IGNORE, MQ_ERROR_PANIC, MqBufferCreate(), MqBufferDelete(), MqBufferSetV(), MqDLogEVL(), MqErrorCopy(), MqErrorSAppendV(), MqErrorSGenVL(), MqExit(), pErrorReport(), pMqGetFirstParent(), and SysAbort().

Referenced by MqErrorSGenVL(), and MqPanicV().

Here is the caller graph for this function:


libmsgque project on SF: Get libmsgque at SourceForge.net. Fast, secure and Free Open Source software downloads    Generated on Mon Nov 9 16:57:12 2009 by doxygen 1.5.8