|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
38 #ifndef included_error_h
39 #define included_error_h
48 #ifdef CLIB_LINUX_KERNEL
49 #include <linux/errno.h>
59 #define clib_warning(format,args...) \
60 _clib_error (CLIB_ERROR_WARNING, clib_error_function, __LINE__, format, ## args)
62 #define clib_error(format,args...) \
63 _clib_error (CLIB_ERROR_FATAL, clib_error_function, __LINE__, format, ## args)
65 #define clib_unix_error(format,args...) \
66 _clib_error (CLIB_ERROR_FATAL | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
68 #define clib_unix_warning(format,args...) \
69 _clib_error (CLIB_ERROR_WARNING | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
72 #define clib_panic(format,args...) \
73 _clib_error (CLIB_ERROR_ABORT, (char *) clib_error_function, __LINE__, format, ## args)
77 #define clib_error_get_code(err) ((err) ? (err)->code : 0)
78 #define clib_error_set_code(err, c) \
86 #define clib_error_free(e) e = clib_error_free_vector(e)
91 char *where,
char *
fmt, ...);
93 #define clib_error_return_code(e,code,flags,args...) \
94 _clib_error_return((e),(code),(flags),(char *)clib_error_function,args)
96 #define clib_error_create(args...) \
97 clib_error_return_code(0,0,0,args)
99 #define clib_error_return(e,args...) \
100 clib_error_return_code(e,0,0,args)
102 #define clib_error_return_unix(e,args...) \
103 clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID,args)
105 #define clib_error_return_fatal(e,args...) \
106 clib_error_return_code(e,0,CLIB_ERROR_FATAL,args)
108 #define clib_error_return_unix_fatal(e,args...) \
109 clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID|CLIB_ERROR_FATAL,args)
113 #define clib_error_report(e) do { (e) = _clib_error_report (e); } while (0)
131 #define IF_ERROR_IS_FATAL_RETURN_ELSE_FREE(e) \
135 if (unix_error_is_fatal (clib_error_get_code (e))) \
138 clib_error_free (e); \
142 #define ERROR_RETURN_IF(x) \
144 clib_error_t * _error_return_if = (x); \
145 if (_error_return_if) \
146 return clib_error_return (_error_return_if, 0); \
149 #define ERROR_ASSERT(truth) \
151 clib_error_t * _error_assert = 0; \
152 if (CLIB_DEBUG > 0 && ! (truth)) \
154 _error_assert = clib_error_return_fatal \
155 (0, "%s:%d (%s) assertion `%s' fails", \
158 clib_error_function, \
165 #define CLIB_ERROR_ASSERT(truth) \
167 clib_error_t * _error_assert = 0; \
171 clib_error_return_fatal \
172 (0, "%s:%d (%s) assertion `%s' fails", \
175 clib_error_function, \
186 #ifndef _Static_assert
187 #define _Static_assert(x,y)
void clib_error_register_handler(clib_error_handler_func_t func, void *arg)
static word unix_error_is_fatal(word error)
u8 * format_clib_error(u8 *s, va_list *va)
void clib_error_handler_func_t(void *arg, u8 *msg, int msg_len)
void * clib_error_free_vector(clib_error_t *errors)
vl_api_wireguard_peer_flags_t flags