FD.io VPP  v21.06
Vector Packet Processing
error.h File Reference
+ Include dependency graph for error.h:

Go to the source code of this file.

Macros

#define clib_warning(format, args...)   _clib_error (CLIB_ERROR_WARNING, clib_error_function, __LINE__, format, ## args)
 
#define clib_error(format, args...)   _clib_error (CLIB_ERROR_FATAL, clib_error_function, __LINE__, format, ## args)
 
#define clib_unix_error(format, args...)   _clib_error (CLIB_ERROR_FATAL | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
 
#define clib_unix_warning(format, args...)   _clib_error (CLIB_ERROR_WARNING | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
 
#define clib_panic(format, args...)   _clib_error (CLIB_ERROR_ABORT, (char *) clib_error_function, __LINE__, format, ## args)
 
#define clib_error_get_code(err)   ((err) ? (err)->code : 0)
 
#define clib_error_set_code(err, c)
 
#define clib_error_free(e)   e = clib_error_free_vector(e)
 
#define clib_error_return_code(e, code, flags, args...)   _clib_error_return((e),(code),(flags),(char *)clib_error_function,args)
 
#define clib_error_create(args...)   clib_error_return_code(0,0,0,args)
 
#define clib_error_return(e, args...)   clib_error_return_code(e,0,0,args)
 
#define clib_error_return_unix(e, args...)   clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID,args)
 
#define clib_error_return_fatal(e, args...)   clib_error_return_code(e,0,CLIB_ERROR_FATAL,args)
 
#define clib_error_return_unix_fatal(e, args...)   clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID|CLIB_ERROR_FATAL,args)
 
#define clib_error_report(e)   do { (e) = _clib_error_report (e); } while (0)
 
#define IF_ERROR_IS_FATAL_RETURN_ELSE_FREE(e)
 
#define ERROR_RETURN_IF(x)
 
#define ERROR_ASSERT(truth)
 
#define CLIB_ERROR_ASSERT(truth)
 

Typedefs

typedef void clib_error_handler_func_t(void *arg, u8 *msg, int msg_len)
 

Functions

void clib_error_register_handler (clib_error_handler_func_t func, void *arg)
 
void * clib_error_free_vector (clib_error_t *errors)
 
u8format_clib_error (u8 *s, va_list *va)
 
static word unix_error_is_fatal (word error)
 

Macro Definition Documentation

◆ clib_error

#define clib_error (   format,
  args... 
)    _clib_error (CLIB_ERROR_FATAL, clib_error_function, __LINE__, format, ## args)

Definition at line 62 of file error.h.

◆ CLIB_ERROR_ASSERT

#define CLIB_ERROR_ASSERT (   truth)
Value:
({ \
clib_error_t * _error_assert = 0; \
if (! (truth)) \
{ \
_error_assert = \
clib_error_return_fatal \
(0, "%s:%d (%s) assertion `%s' fails", \
__FILE__, \
(uword) __LINE__, \
# truth); \
} \
_error_assert; \
})
#define clib_error_function
u64 uword
Definition: types.h:112

Definition at line 165 of file error.h.

◆ clib_error_create

#define clib_error_create (   args...)    clib_error_return_code(0,0,0,args)

Definition at line 96 of file error.h.

◆ clib_error_free

#define clib_error_free (   e)    e = clib_error_free_vector(e)

Definition at line 86 of file error.h.

◆ clib_error_get_code

#define clib_error_get_code (   err)    ((err) ? (err)->code : 0)

Definition at line 77 of file error.h.

◆ clib_error_report

#define clib_error_report (   e)    do { (e) = _clib_error_report (e); } while (0)

Definition at line 113 of file error.h.

◆ clib_error_return

#define clib_error_return (   e,
  args... 
)    clib_error_return_code(e,0,0,args)

Definition at line 99 of file error.h.

◆ clib_error_return_code

#define clib_error_return_code (   e,
  code,
  flags,
  args... 
)    _clib_error_return((e),(code),(flags),(char *)clib_error_function,args)

Definition at line 93 of file error.h.

◆ clib_error_return_fatal

#define clib_error_return_fatal (   e,
  args... 
)    clib_error_return_code(e,0,CLIB_ERROR_FATAL,args)

Definition at line 105 of file error.h.

◆ clib_error_return_unix

#define clib_error_return_unix (   e,
  args... 
)    clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID,args)

Definition at line 102 of file error.h.

◆ clib_error_return_unix_fatal

#define clib_error_return_unix_fatal (   e,
  args... 
)    clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID|CLIB_ERROR_FATAL,args)

Definition at line 108 of file error.h.

◆ clib_error_set_code

#define clib_error_set_code (   err,
  c 
)
Value:
do { \
if (err) \
(err)->code = (c); \
} while (0)
svmdb_client_t * c

Definition at line 78 of file error.h.

◆ clib_panic

#define clib_panic (   format,
  args... 
)    _clib_error (CLIB_ERROR_ABORT, (char *) clib_error_function, __LINE__, format, ## args)

Definition at line 72 of file error.h.

◆ clib_unix_error

#define clib_unix_error (   format,
  args... 
)    _clib_error (CLIB_ERROR_FATAL | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)

Definition at line 65 of file error.h.

◆ clib_unix_warning

#define clib_unix_warning (   format,
  args... 
)    _clib_error (CLIB_ERROR_WARNING | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)

Definition at line 68 of file error.h.

◆ clib_warning

#define clib_warning (   format,
  args... 
)    _clib_error (CLIB_ERROR_WARNING, clib_error_function, __LINE__, format, ## args)

Definition at line 59 of file error.h.

◆ ERROR_ASSERT

#define ERROR_ASSERT (   truth)
Value:
({ \
clib_error_t * _error_assert = 0; \
if (CLIB_DEBUG > 0 && ! (truth)) \
{ \
_error_assert = clib_error_return_fatal \
(0, "%s:%d (%s) assertion `%s' fails", \
__FILE__, \
(uword) __LINE__, \
# truth); \
} \
_error_assert; \
})
#define clib_error_function
#define clib_error_return_fatal(e, args...)
Definition: error.h:105
u64 uword
Definition: types.h:112

Definition at line 149 of file error.h.

◆ ERROR_RETURN_IF

#define ERROR_RETURN_IF (   x)
Value:
do { \
clib_error_t * _error_return_if = (x); \
if (_error_return_if) \
return clib_error_return (_error_return_if, 0); \
} while (0)
#define clib_error_return(e, args...)
Definition: error.h:99

Definition at line 142 of file error.h.

◆ IF_ERROR_IS_FATAL_RETURN_ELSE_FREE

#define IF_ERROR_IS_FATAL_RETURN_ELSE_FREE (   e)
Value:
do { \
if (e) \
{ \
return (e); \
} \
} while (0)
static word unix_error_is_fatal(word error)
Definition: error.h:118
#define clib_error_get_code(err)
Definition: error.h:77
#define clib_error_free(e)
Definition: error.h:86

Definition at line 131 of file error.h.

Typedef Documentation

◆ clib_error_handler_func_t

typedef void clib_error_handler_func_t(void *arg, u8 *msg, int msg_len)

Definition at line 56 of file error.h.

Function Documentation

◆ clib_error_free_vector()

void* clib_error_free_vector ( clib_error_t errors)

Definition at line 182 of file error.c.

+ Here is the caller graph for this function:

◆ clib_error_register_handler()

void clib_error_register_handler ( clib_error_handler_func_t  func,
void *  arg 
)

Definition at line 75 of file error.c.

+ Here is the caller graph for this function:

◆ format_clib_error()

u8* format_clib_error ( u8 s,
va_list *  va 
)

Definition at line 191 of file error.c.

◆ unix_error_is_fatal()

static word unix_error_is_fatal ( word  error)
inlinestatic

Definition at line 118 of file error.h.

+ Here is the caller graph for this function: