All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
log.c File Reference
#include <freeradius-devel/libradius.h>
+ Include dependency graph for log.c:

Go to the source code of this file.

Macros

#define FR_STRERROR_BUFSIZE   (2048)
 

Functions

static void _fr_logging_free (void *arg)
 
void fr_canonicalize_error (TALLOC_CTX *ctx, char **sp, char **text, ssize_t slen, char const *msg)
 Canonicalize error strings, removing tabs, and generate spaces for error marker. More...
 
void fr_perror (char const *fmt,...)
 
char const * fr_strerror (void)
 Get the last library error. More...
 
void fr_strerror_printf (char const *fmt,...)
 Log to thread local error buffer. More...
 
char const * fr_syserror (int num)
 Guaranteed to be thread-safe version of strerror. More...
 
 fr_thread_local_setup (char *, fr_strerror_buffer)
 POSIX-2008 errno macros. More...
 

Macro Definition Documentation

#define FR_STRERROR_BUFSIZE   (2048)

Definition at line 35 of file log.c.

Function Documentation

static void _fr_logging_free ( void *  arg)
static

Definition at line 142 of file log.c.

+ Here is the caller graph for this function:

void fr_canonicalize_error ( TALLOC_CTX *  ctx,
char **  sp,
char **  text,
ssize_t  slen,
char const *  msg 
)

Canonicalize error strings, removing tabs, and generate spaces for error marker.

Note
talloc_free must be called on the buffer returned in spaces and text

Used to produce error messages such as this:

 I'm a string with a parser # error
                            ^ Unexpected character in string

With code resembling this:

ERROR("%s", parsed_str);
ERROR("%s^ %s", space, text);
Todo:
merge with above function (radlog_request_marker)
Parameters
spWhere to write a dynamically allocated buffer of spaces used to indent the error text.
textWhere to write the canonicalized version of msg (the error text).
ctxto allocate the spaces and text buffers in.
slenof error marker. Expects negative integer value, as returned by parse functions.
msgto canonicalize.

Definition at line 359 of file log.c.

+ Here is the caller graph for this function:

void fr_perror ( char const *  fmt,
  ... 
)

Definition at line 317 of file log.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Returns
library error or zero length string.

Definition at line 212 of file log.c.

+ Here is the caller graph for this function:

void fr_strerror_printf ( char const *  fmt,
  ... 
)

Log to thread local error buffer.

Parameters
fmtprintf style format string. If NULL sets the 'new' byte to false, effectively clearing the last message.

Definition at line 152 of file log.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* fr_syserror ( int  num)

Guaranteed to be thread-safe version of strerror.

Parameters
numerrno as returned by function or from global errno.
Returns
local specific error string relating to errno.

Definition at line 238 of file log.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

fr_thread_local_setup ( char *  ,
fr_strerror_buffer   
)

POSIX-2008 errno macros.

Non-POSIX macros may be added, but you must check they're defined.

Definition at line 37 of file log.c.