The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Support functions to allow libraries to provide errors to their callers. More...
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <string.h>
#include <stdarg.h>
Go to the source code of this file.
Add an error string to the thread local error stack | |
| |
static void | _fr_strerror_printf (char const *file, int line, char const *fmt,...) |
static void | _fr_strerror_printf_push (char const *file, int line, char const *fmt,...) |
static void | _fr_strerror_printf_push_head (char const *file, int line, char const *fmt,...) |
void | _fr_strerror_vprintf (char const *file, int line, char const *fmt, va_list ap) |
Log to thread local error buffer. | |
void | _fr_strerror_vprintf_push (char const *file, int line, char const *fmt, va_list ap) |
Add a message to an existing stack of messages at the tail. | |
void | _fr_strerror_vprintf_push_head (char const *file, int line, char const *fmt, va_list ap) |
Add a message to an existing stack of messages at the head. | |
#define | fr_strerror_printf(_fmt, ...) _fr_strerror_printf(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Log to thread local error buffer. | |
#define | fr_strerror_printf_push(_fmt, ...) _fr_strerror_printf_push(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Add a message to an existing stack of messages at the tail. | |
#define | fr_strerror_printf_push_head(_fmt, ...) _fr_strerror_printf_push_head(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Add a message to an existing stack of messages at the head. | |
#define | fr_strerror_vprintf(_fmt, _ap) _fr_strerror_vprintf(__FILE__, __LINE__, _fmt, _ap) |
#define | fr_strerror_vprintf_push(_fmt, _ap) _fr_strerror_vprintf_push(__FILE__, __LINE, _fmt, _ap) |
#define | fr_strerror_vprintf_push_head(_fmt, _ap) _fr_strerror_vprintf_push_head(__FILE__, __LINE__, _fmt, _ap) |
Add an error string with marker to the thread local error stack | |
| |
static void | _fr_strerror_marker_printf (char const *file, int line, char const *subject, size_t offset, char const *fmt,...) |
static void | _fr_strerror_marker_printf_push (char const *file, int line, char const *subject, size_t offset, char const *fmt,...) |
static void | _fr_strerror_marker_printf_push_head (char const *file, int line, char const *subject, size_t offset, char const *fmt,...) |
void | _fr_strerror_marker_vprintf (char const *file, int line, char const *subject, size_t offset, char const *fmt, va_list ap) |
Add an error marker to an existing stack of messages. | |
void | _fr_strerror_marker_vprintf_push (char const *file, int line, char const *subject, size_t offset, char const *fmt, va_list ap) |
Add an error marker to an existing stack of messages at the tail. | |
void | _fr_strerror_marker_vprintf_push_head (char const *file, int line, char const *subject, size_t offset, char const *fmt, va_list ap) |
Add an error marker to an existing stack of messages at the head. | |
#define | fr_strerror_marker_printf(_subject, _offset, _fmt, ...) _fr_strerror_marker_printf(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages. | |
#define | fr_strerror_marker_printf_push(_subject, _offset, _fmt, ...) _fr_strerror_marker_printf_push(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages at the tail. | |
#define | fr_strerror_marker_printf_push_head(_subject, _offset, _fmt, ...) _fr_strerror_marker_printf_push_head(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages at the head. | |
#define | fr_strerror_marker_vprintf(_subject, _offset, _fmt, _ap) _fr_strerror_marker_vprintf(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
#define | fr_strerror_marker_vprintf_push(_subject, _offset, _fmt, _ap) _fr_strerror_marker_vprintf_push(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
#define | fr_strerror_marker_vprintf_push_head(_subject, _offset, _fmt, _ap) _fr_strerror_marker_vprintf_push_head(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
Add a const error string to the thread local error stack | |
| |
void | _fr_strerror_const (char const *file, int line, char const *msg) |
Log to thread local error buffer. | |
void | _fr_strerror_const_push (char const *file, int line, char const *msg) |
Add a message to an existing stack of messages at the tail. | |
void | _fr_strerror_const_push_head (char const *file, int line, char const *msg) |
Add a message to an existing stack of messages at the head. | |
#define | fr_strerror_const(_msg) _fr_strerror_const(__FILE__, __LINE__, _msg) |
#define | fr_strerror_const_push(_msg) _fr_strerror_const_push(__FILE__, __LINE__, _msg) |
#define | fr_strerror_const_push_head(_msg) _fr_strerror_const_push_head(__FILE__, __LINE__, _msg) |
Retrieve errors from the thread local error stack | |
void | fr_perror (char const *,...)) |
Print the current error to stderr with a prefix. | |
char const * | fr_perror_to_str (char const *line_sep, char const *fmt,...)) |
Print the stack of string buffers to a thread local buffer. | |
char const * | fr_strerror (void) |
Get the last library error. | |
void | fr_strerror_clear (void) |
Clears all pending messages from the talloc pools. | |
char const * | fr_strerror_marker (char const **subject, size_t *offset) |
Get the last library error marker. | |
char const * | fr_strerror_marker_peek (char const **subject, size_t *offset) |
Get the last library error marker. | |
char const * | fr_strerror_marker_pop (char const **subject, size_t *offset) |
Pop the last library error with marker information. | |
char const * | fr_strerror_peek (void) |
Get the last library error. | |
char const * | fr_strerror_pop (void) |
Pop the last library error. | |
Support functions to allow libraries to provide errors to their callers.
Definition in file strerror.h.
#define fr_strerror_const | ( | _msg | ) | _fr_strerror_const(__FILE__, __LINE__, _msg) |
Definition at line 223 of file strerror.h.
#define fr_strerror_const_push | ( | _msg | ) | _fr_strerror_const_push(__FILE__, __LINE__, _msg) |
Definition at line 227 of file strerror.h.
#define fr_strerror_const_push_head | ( | _msg | ) | _fr_strerror_const_push_head(__FILE__, __LINE__, _msg) |
Definition at line 231 of file strerror.h.
#define fr_strerror_marker_printf | ( | _subject, | |
_offset, | |||
_fmt, | |||
... | |||
) | _fr_strerror_marker_printf(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages.
[in] | _subject | to mark up. |
[in] | _offset | Positive offset to show where the error should be positioned. |
[in] | _fmt | Error string. |
[in] | ... | Arguments for the error string. |
Definition at line 154 of file strerror.h.
#define fr_strerror_marker_printf_push | ( | _subject, | |
_offset, | |||
_fmt, | |||
... | |||
) | _fr_strerror_marker_printf_push(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages at the tail.
[in] | _subject | to mark up. |
[in] | _offset | Positive offset to show where the error should be positioned. |
[in] | _fmt | Error string. |
[in] | ... | Arguments for the error string. |
Definition at line 178 of file strerror.h.
#define fr_strerror_marker_printf_push_head | ( | _subject, | |
_offset, | |||
_fmt, | |||
... | |||
) | _fr_strerror_marker_printf_push_head(__FILE__, __LINE__, _subject, _offset, _fmt, ##__VA_ARGS__) |
Add an error marker to an existing stack of messages at the head.
[in] | _subject | to mark up. |
[in] | _offset | Positive offset to show where the error should be positioned. |
[in] | _fmt | Error string. |
[in] | ... | Arguments for the error string. |
Definition at line 202 of file strerror.h.
#define fr_strerror_marker_vprintf | ( | _subject, | |
_offset, | |||
_fmt, | |||
_ap | |||
) | _fr_strerror_marker_vprintf(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
Definition at line 126 of file strerror.h.
#define fr_strerror_marker_vprintf_push | ( | _subject, | |
_offset, | |||
_fmt, | |||
_ap | |||
) | _fr_strerror_marker_vprintf_push(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
Definition at line 132 of file strerror.h.
#define fr_strerror_marker_vprintf_push_head | ( | _subject, | |
_offset, | |||
_fmt, | |||
_ap | |||
) | _fr_strerror_marker_vprintf_push_head(__FILE__, __LINE__, _subject, _offset, _fmt, _ap) |
Definition at line 138 of file strerror.h.
#define fr_strerror_printf | ( | _fmt, | |
... | |||
) | _fr_strerror_printf(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Log to thread local error buffer.
[in] | _fmt | printf style format string. If NULL clears any existing messages. |
[in] | ... | Arguments for the format string. |
Definition at line 64 of file strerror.h.
#define fr_strerror_printf_push | ( | _fmt, | |
... | |||
) | _fr_strerror_printf_push(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Add a message to an existing stack of messages at the tail.
[in] | _fmt | printf style format string. |
[in] | ... | Arguments for the format string. |
Definition at line 84 of file strerror.h.
#define fr_strerror_printf_push_head | ( | _fmt, | |
... | |||
) | _fr_strerror_printf_push_head(__FILE__, __LINE__, _fmt, ##__VA_ARGS__) |
Add a message to an existing stack of messages at the head.
[in] | _fmt | printf style format string. |
[in] | ... | Arguments for the format string. |
Definition at line 104 of file strerror.h.
#define fr_strerror_vprintf | ( | _fmt, | |
_ap | |||
) | _fr_strerror_vprintf(__FILE__, __LINE__, _fmt, _ap) |
Definition at line 44 of file strerror.h.
#define fr_strerror_vprintf_push | ( | _fmt, | |
_ap | |||
) | _fr_strerror_vprintf_push(__FILE__, __LINE, _fmt, _ap) |
Definition at line 48 of file strerror.h.
#define fr_strerror_vprintf_push_head | ( | _fmt, | |
_ap | |||
) | _fr_strerror_vprintf_push_head(__FILE__, __LINE__, _fmt, _ap) |
Definition at line 52 of file strerror.h.
void _fr_strerror_const | ( | char const * | file, |
int | line, | ||
char const * | msg | ||
) |
Log to thread local error buffer.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | msg | To add to error stack. Must have a lifetime equal to that of the program. |
Definition at line 450 of file strerror.c.
void _fr_strerror_const_push | ( | char const * | file, |
int | line, | ||
char const * | msg | ||
) |
Add a message to an existing stack of messages at the tail.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | msg | To add to error stack. Must have a lifetime equal to that of the program. |
Definition at line 508 of file strerror.c.
void _fr_strerror_const_push_head | ( | char const * | file, |
int | line, | ||
char const * | msg | ||
) |
Add a message to an existing stack of messages at the head.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | msg | To add to error stack. Must have a lifetime equal to that of the program. |
Definition at line 531 of file strerror.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void _fr_strerror_marker_vprintf | ( | char const * | file, |
int | line, | ||
char const * | subject, | ||
size_t | offset, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Add an error marker to an existing stack of messages.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | subject | to mark up. |
[in] | offset | Positive offset to show where the error should be positioned. |
[in] | fmt | Error string. |
[in] | ap | Arguments for the error string. |
Definition at line 320 of file strerror.c.
void _fr_strerror_marker_vprintf_push | ( | char const * | file, |
int | line, | ||
char const * | subject, | ||
size_t | offset, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Add an error marker to an existing stack of messages at the tail.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | subject | to mark up. |
[in] | offset | Positive offset to show where the error should be positioned. |
[in] | fmt | Error string. |
[in] | ap | Arguments for the error string. |
Definition at line 348 of file strerror.c.
void _fr_strerror_marker_vprintf_push_head | ( | char const * | file, |
int | line, | ||
char const * | subject, | ||
size_t | offset, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Add an error marker to an existing stack of messages at the head.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | subject | to mark up. |
[in] | offset | Positive offset to show where the error should be positioned. |
[in] | fmt | Error string. |
[in] | ap | Arguments for the error string. |
Definition at line 382 of file strerror.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void _fr_strerror_vprintf | ( | char const * | file, |
int | line, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Log to thread local error buffer.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | fmt | printf style format string. If NULL clears any existing messages. |
[in] | ap | Arguments for the format string. |
Definition at line 245 of file strerror.c.
void _fr_strerror_vprintf_push | ( | char const * | file, |
int | line, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Add a message to an existing stack of messages at the tail.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | fmt | printf style format string. |
[in] | ap | Arguments for the format string. |
Definition at line 263 of file strerror.c.
void _fr_strerror_vprintf_push_head | ( | char const * | file, |
int | line, | ||
char const * | fmt, | ||
va_list | ap | ||
) |
Add a message to an existing stack of messages at the head.
[in] | file | the error occurred in. |
[in] | line | the error occurred on. |
[in] | fmt | printf style format string. |
[in] | ap | Arguments for the format string. |
Definition at line 290 of file strerror.c.
void fr_perror | ( | char const * | fmt, |
... | |||
) |
Print the current error to stderr with a prefix.
Used by utility functions lacking their own logging infrastructure
Definition at line 733 of file strerror.c.
char const * fr_perror_to_str | ( | char const * | line_sep, |
char const * | fmt, | ||
... | |||
) |
Print the stack of string buffers to a thread local buffer.
Used by utility functions lacking their own logging infrastructure
[in] | line_sep | to insert between the log lines. |
[in] | fmt | to prefix all log messages with. |
Definition at line 779 of file strerror.c.
char const * fr_strerror | ( | void | ) |
Get the last library error.
Will only return the last library error once, after which it will return a zero length string. If there are additional messages on the log stack they will be discarded.
Definition at line 554 of file strerror.c.
void fr_strerror_clear | ( | void | ) |
Clears all pending messages from the talloc pools.
Definition at line 577 of file strerror.c.
char const * fr_strerror_marker | ( | char const ** | subject, |
size_t * | offset | ||
) |
Get the last library error marker.
[out] | subject | The subject string the error relates to. |
[out] | offset | Where to place the marker. |
Definition at line 598 of file strerror.c.
char const * fr_strerror_marker_peek | ( | char const ** | subject, |
size_t * | offset | ||
) |
Get the last library error marker.
[out] | subject | The subject string the error relates to. |
[out] | offset | Where to place the marker. |
Definition at line 651 of file strerror.c.
char const * fr_strerror_marker_pop | ( | char const ** | subject, |
size_t * | offset | ||
) |
Pop the last library error with marker information.
Return the first message added to the error stack using fr_strerror_printf or fr_strerror_printf_push.
Definition at line 708 of file strerror.c.
char const * fr_strerror_peek | ( | void | ) |
Get the last library error.
Definition at line 627 of file strerror.c.
char const * fr_strerror_pop | ( | void | ) |
Pop the last library error.
Return the first message added to the error stack using fr_strerror_printf or fr_strerror_printf_push.
Definition at line 681 of file strerror.c.